playMaker

Author Topic: Rotation towards movement direction but with translating movement [SOLVED]  (Read 119 times)

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 987
    • View Profile
    • Fat Pug Studio
Hi all,

i'm trying to find a solution for rotating some missiles towards direction.

After they're being fired they are moved using translate with no set target. I'm not using velocity so i can't get the direction with velocity data (it's 0,0 since i'm translating the missiles), and i don't know how can i get the direction every frame to apply the rotation by using some other method.

All ideas except "move them using velocity" are welcome  ;D

Edit: of course, the child will be rotating so it doesn't affect the movement.
« Last Edit: June 01, 2019, 02:37:42 PM by krmko »

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 987
    • View Profile
    • Fat Pug Studio
Re: Rotation towards movement direction but with translating movement
« Reply #1 on: May 31, 2019, 06:38:32 AM »
I was just wondering, if i get the current position and last frame position, and subtract current from last frame position i should be getting the vector that shows the missile's heading. How can i apply that vector to the rotation of the child object?
« Last Edit: May 31, 2019, 06:50:42 AM by krmko »

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 987
    • View Profile
    • Fat Pug Studio
Re: Rotation towards movement direction but with translating movement
« Reply #2 on: May 31, 2019, 07:26:42 AM »
Or maybe simply rotate towards last frame position but in opposite direction, hmmm.

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 987
    • View Profile
    • Fat Pug Studio
Got it the simple way. Get position, look at with 180 degree offset in the next state, loop.