In flash i have a class that extends movieclip and i am moving it forward, up and down, and rotating it. How can i calculate the vector that is perpendicular to this movieclip?
|
Well as explained here it is pretty easy to get the perpendicular vector from the movement vector:
So you just need to calculate the direction vector and then do what they said. Now how exactly you should calculate the direction vector will depend on your specific implementation; since you haven't provided us any code I'm not sure what you are doing. However I'll give an explanation based on one common implementation; you simply store the scalar speed of the moving object, and every frame calculate a movement vector based on that speed and the rotation. In that case the movement vector is calculated using simple trigonometry, something like:
|
|||
|
|
|
In 3D, I'd just take the cross product of the movement vector and the up vector. |
|||
