Page 1 of 1

Switching Spline Animators

Posted: Thu Nov 13, 2008 8:46 am
by aungsithu
Hi,

I've two spline animators. And I add one animator to one scene node and let that scene node follow it. And after some time, I want that scene node to switch to the other spline animator and want to follow that spline. Then it may be after some time, I want the scene node to use the previous spline again and follow it.

I don't know how to do or if it's can be done.
Does it make any sense at all?

Thanks in advance.

Posted: Thu Nov 13, 2008 8:49 am
by JP
When you want to switch you just remove the old animator and add the new one... The point at which you switch you haven't specified so if you need help on that then post again.

Posted: Thu Nov 13, 2008 9:39 am
by aungsithu
Thanks JP.

Is it possible to switch the spline with the speed on previous spline?
Because now when I remove the animators and add the new animator, the scene node jumps to that new animator, not smoothly.

Image

In fact, I'm trying to use the splines as a guide for cars. So, when a car overtakes another, it needs to choose one spline which the car in front is not using. So, as in my attached figure, I want to switch from one spline to another smoothly.

Is it possible with these animators?

Thanks

Posted: Thu Nov 13, 2008 9:45 am
by JP
I think the spline animator is a bit too limited for what you want.... I guess it's possible but you might be better off designing your own system to handle this...

I guess if you want to make a car overtake and join the next spline a bit further ahead then you'd have to kind of find the position ahead which you want it to start on the other spline and then remove the current spline and then interpolate its position to move it into position on the next spline and then add the spline animator to it so it will carry on... I guess you could use a fly straight animator to move it into position on the next spline...

Posted: Thu Nov 13, 2008 10:04 am
by aungsithu
I see.
When I manually move my objects between waypoints, I can know my object's next wp, prev wp, etc. But now I've no control over my object which is moving along the spline.

So, how can I know my object's current target wp?

Many Thanks

Posted: Thu Nov 13, 2008 10:12 am
by JP
I would move them manually then, it will give you the added control you require. It may seem nice to use the follow spline animator but it's doing very little work really, it'll just be moving between the points passed to it in a similar way to the fly straight animator which is a trivial task. What you could do is do it manually but use the fly straight animator to move between the points if you'd rather not code the movement itself manually.

Posted: Thu Nov 13, 2008 12:26 pm
by hybrid
As with many other things in Irrlicht (see cameras...) the built-in implementations are good for very common things, but not for app-specific ones. This would lead to far too much complexity, both on the interfaces and the logic. Instead, just take a look at the code and do your own animators. It's far simpler than one might assume, and it will give you full flexibility over the behavior of your nodes.

Posted: Thu Nov 13, 2008 3:52 pm
by aungsithu
Hi,

Thanks JP and hybrid.
I got your point. 8)