How the calculate the angle according the speed?

edited October 2013 in General discussions
I have check the object API, I am not sure if a can calculate the object angle according the speed? I want to change the anim or rotation the object according to the speed, in order the object actor a real object. such as missile or others that a direction associate. Or are there other good approach for this job?


  • edited October 2013
    I'm not sure I understand your question.
    Something like this?
  • edited October 2013
    Suppose the object at a (-100, 50, 0) speed, how to calc the angle between object and the axis(X for example).
    By the way, how to compile the MushroomStew. I'd like to play with it :)
  • edited October 2013
    If I understand it correctly you want the angle of the line between the object and another point, right?
    If that is the case:
    orxMath_ATan(pos1->fY - pos2->fY, pos1->fX - pos2->fX);

    Assumining pos1 and pos2 are orxVector*. The result will be in radians.
  • edited October 2013
    Regarding Mushroom Stew, if you sync a version of orx from the same period, it should compile just fine. :)

    As for the angle, if you're not entirely comfortable with the trigonometry Knolan exposed, you could always convert from cartesian to spherical coordinates using orx.
Sign In or Register to comment.