- #1

tnutty

- 326

- 1

//F = mg*sin(theta) = ma;

//a = F/ m

//a = mgsin(theta) / m

//a = g*sin(theta)

ball.accelVec = Vector3D( g * sin( changeInAngle ) ,g * cos(changeInAngle) , 0.0f );

//V = v_0 + a*t

ball.velVec += ball.accelVec * deltaTime;

// X = v*dt + 1/2 a*dt^2

ball.posVec += ball.velVec * deltaTime + 1.0f/2.0f * ball.accelVec * deltaTime * deltaTime;

changeInAngle = atan2( ball.posVec.getY(), ball.posVec.getX() ) - restAngle;

rope.setEndPoint( ball.posVec );

------------

Basically, ball.accelVec is the critical one, since everything else depends upon it.

The Vector3D is Vector3D( x ,y z ). So is the acceleration vector correct for the pendulum.

I think the Force for the pendulum should be < w*sin(theta), w*cos(theta) >, where w is

weight and theta is in radians ?

Sorry for the programming language.