playMaker

Author Topic: Rotating child object towards parent  (Read 98 times)

krmko

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Fat Pug Studio
Rotating child object towards parent
« on: October 24, 2017, 06:40:45 AM »
Well, it's kinda harder to explain, so i made this neat little drawing, sorry, i'm at my office so i drew it with mouse.



I've got engine jets that are childed to the ship, and they always stay as they are, no matter if the ship moves up or down. What i want is to rotate them slightly when the ship moves up or down, as described in the picture. Now, if it wasn't childed, i could rotate it towards, but as it keeps it's local position, that doesn't work of course.

By the way, i use translate for moving the ship, i don't know what property should i listen to to adjust the rotation of the jet according to the ship movement?

Groo Gadgets

  • Junior Playmaker
  • **
  • Posts: 95
    • View Profile
Re: Rotating child object towards parent
« Reply #1 on: October 24, 2017, 08:12:12 AM »
Heya,

If the ship is the player you can use the input as the base for the jet rotation. Use the float remap action from the Ecosystem to remap the input value to a suitable rotation angle. I've done a similar technique in my spaceship game  :-)

Cheers,

Simon

krmko

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • Fat Pug Studio
Re: Rotating child object towards parent
« Reply #2 on: October 24, 2017, 09:10:45 AM »
Hi mate, thanks for the suggestion, i will use it for the players ship for sure! Unfortunately, this is for the enemies, moving via tween and velocity/translate.

Hm, but i may use float remap for enemies too, i'll try it out!
« Last Edit: October 24, 2017, 11:40:50 PM by krmko »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Rotating child object towards parent
« Reply #3 on: November 02, 2017, 12:13:13 AM »
Hi,

 you could also get the speed of the gameobject ( get GameObjectSpeed on the ecosystem), which will give you the direction and that;'s would be where your engine should look at.

 however for more believable effect, indeed listening to the input would allow the engine to act before the ship actually moves giving a more believable effect visually.

 Bye,

 Jean