Switching Spline Animators

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
aungsithu
Posts: 39
Joined: Thu Sep 04, 2008 2:14 am
Location: Singapore
Contact:

Switching Spline Animators

Post 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.
Aung Sithu
*** Check out my latest book, Beginner's guide to Irrlicht 3D engine: http://bit.ly/rSnm4O
Company: http://rivaledge.sg
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
aungsithu
Posts: 39
Joined: Thu Sep 04, 2008 2:14 am
Location: Singapore
Contact:

Post 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
Aung Sithu
*** Check out my latest book, Beginner's guide to Irrlicht 3D engine: http://bit.ly/rSnm4O
Company: http://rivaledge.sg
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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...
Image Image Image
aungsithu
Posts: 39
Joined: Thu Sep 04, 2008 2:14 am
Location: Singapore
Contact:

Post 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
Aung Sithu
*** Check out my latest book, Beginner's guide to Irrlicht 3D engine: http://bit.ly/rSnm4O
Company: http://rivaledge.sg
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
aungsithu
Posts: 39
Joined: Thu Sep 04, 2008 2:14 am
Location: Singapore
Contact:

Post by aungsithu »

Hi,

Thanks JP and hybrid.
I got your point. 8)
Aung Sithu
*** Check out my latest book, Beginner's guide to Irrlicht 3D engine: http://bit.ly/rSnm4O
Company: http://rivaledge.sg
Post Reply