A couple of questions on StuntPlayground source code

syedhs

18-06-2006 07:12:31

Walaber,

I read thru your source code, and there are sections which I couldn't get myself to understand them:

1) What is the use of DummyBody?

2) Take a look at the code below:-

mFollowCam = new FollowCamera( mCamera );
mFollowCam->setGoalNode( mArenaBody->getOgreNode() );
mFollowCam->setGoalDistance( 30.0f );
mFollowCam->setJustFollow(true);
mFollowCam->setGoalNode(mDummyBody->getNewtonBody()->getOgreNode() );

Why do we need GoalNode, GoalDistance and then subsequently another GoalNode (overriding the previous GoalNode?)

Thanks.

walaber

18-06-2006 07:45:27

DummyBody is kind of complex, but it is the 3D cursor object that the user can drag around. it takes on the collision shape of objects when dragging them around, otherwise it's a simple cube.

as for the followcam code, that's probably just sloppy coding :D

syedhs

18-06-2006 11:16:41

Thanks for the reply walaber.

Uhmm.. regarding question (2).. I think I need to dig a lil bit more :) - why do we need to use GoalNode and GoalDistance? I noticed that you pass the scenenode of the Arena, for which I am not sure of its uses.

walaber

18-06-2006 18:38:20

you can ignore the first call to SetGoalNode. that is a mistake.

basically the FollowCamera class takes a goal node, and a distance to maintain away from that node. it can also take a specific angle to maintain, which is what it uses in driving mode to stay behind the car. that part is turned off in editing mode so the user can control the camera.

syedhs

22-06-2006 02:26:01

walaber, hey thanks for the great code. I can see that your camera code is great.. along with the ability to specify the camera angles in an .xml file. Save me many days of programming.. again great job!