Page 1 of 1

How to make an actor rotate to another one?

PostPosted: Tue Sep 07, 2010 6:43 pm
by NevenResnik
Is there a way to make an actor rotate to another actor, either by using the angle function, the x,y axis or whatever?

Thanks!

Re: How to make an actor rotate to another one?

PostPosted: Wed Sep 08, 2010 2:38 am
by DilloDude
To make an actor rotate, you need to do it in the animation. So you pre-rotate the image in your image editor.
Usually about 36 frames works well (10 degrees rotation per frame) although for larger images you'll want more, and for small images you can get away with less.
Then you can use the direction function to find the angle between the two actors, and do a little bit of simple maths to find the correct animation frame. If you want to have a smooth rotation (so it turns over a short time period, rather than instantly), you can use my ReDir function.
Hope that helps, let me know if you have trouble with it.