L path

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
The Onslaught
Posts: 41
Joined: Mon Jan 29, 2007 3:33 pm

L path

Post by The Onslaught »

Hi, I'm a newbie.

I am trying to make a mesh follow a L path.

How's the best way to achieve it? Create 2 straight fly animators or a follow spline animator?

If it is possible please show me a code snippet

Thanks y'all
After reading this sentence you will realize you have wasted 5 seconds of your life
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

A spline sounds like a good option to achieve this, check out the API for the follow spline animator (link) to see how it should be used
The Onslaught
Posts: 41
Joined: Mon Jan 29, 2007 3:33 pm

Post by The Onslaught »

Thanks for the reply it really helped,

Now I have another question, between the two paths of the L path, I need to rotate the node, how can I achieve this?

Thaks
After reading this sentence you will realize you have wasted 5 seconds of your life
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Ah, that can be a bit more difficult

I assume you want to rotate it so it's oriented towards the next set point in your spline declaration?
The Onslaught
Posts: 41
Joined: Mon Jan 29, 2007 3:33 pm

Post by The Onslaught »

yeah, exactly.
After reading this sentence you will realize you have wasted 5 seconds of your life
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

You could take the hacky route and check every frame at which position your mesh is and rotate it accordingly, but I'd rather suggest that you check out the implementation of the follow spline animator, and that you implement your own animator using this code, altering it to take your rotation into account

This would be the cleanest way to achieve what you want
The Onslaught
Posts: 41
Joined: Mon Jan 29, 2007 3:33 pm

Post by The Onslaught »

Alright, it seems that my own implementation will be the only way to achieve this, thanks Radikalizm for your help.

One last question, in order for the path to go straight, the spline tightness should be 0 or 1?
After reading this sentence you will realize you have wasted 5 seconds of your life
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

The Onslaught wrote:Alright, it seems that my own implementation will be the only way to achieve this, thanks Radikalizm for your help.

One last question, in order for the path to go straight, the spline tightness should be 0 or 1?
To be honest, I haven't used the animator that much, so I can't give you an answer

You should try and see what works, or wait until someone else can answer your question

EDIT:

By the way, when you finish your animator (if you're going for the custom implementation that is) it might be a good idea to post it in the code snippets forum if you would be willing, I could see more people wanting this kind of animator
Post Reply