CreateFollowSplineAnimator and IAnimatedMeshSceneNode rotn

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
busybee
Posts: 1
Joined: Sat May 27, 2006 11:44 am
Location: France

CreateFollowSplineAnimator and IAnimatedMeshSceneNode rotn

Post by busybee »

I want an IAnimatedMeshSceneNode to follow a curved path, so thought of using the CreateFollowSplineAnimator function. The node always faces the same direction though - is there any way to override the direction to get it to face the direction of motion?

Secondly, the default for the spline is to repeat the animation, with flystraight there is a bool loop parameter - is this possible with the spline?

(Failing this I presume I have to crea tthe spline myself with the direction of movement and update the node with the path.)

Thanks
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

No, currently the animator is not able to make the camera look into a direction or play it not looped. But you're invited to add this functionality if you like :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Aren't Acki's animation extension adding some of these features?
BernieRoehl
Posts: 6
Joined: Fri Oct 27, 2006 9:39 pm

Post by BernieRoehl »

niko wrote:No, currently the animator is not able to make the camera look into a direction or play it not looped. But you're invited to add this functionality if you like :)
Here's a quick-and-dirty work-around:

Code: Select all

static core::vector3df previous_position = core::vector3df(0,0,0);
//... later, in the main loop
scene::ICameraSceneNode* sscam = sceneManager->getActiveCamera();
	sscam->setTarget(sscam->getPosition() - previous_position + sscam->getPosition());
	previous_position = sscam->getPosition();
This causes the camera to look along the path it's following. It takes the current position, subtracts the previoius position to find a vector pointing in the direction of travel, then adds it to the current position and sets the result as the camera target position.
Post Reply