playMaker

Author Topic: Setting same angle as top level parent  (Read 402 times)

Simmehh

  • Playmaker Newbie
  • *
  • Posts: 2
Setting same angle as top level parent
« on: October 07, 2022, 09:36:27 PM »
Hi,

I'm pretty new to this (old account I bought playmaker years ago with best intentions)

I'm trying to get the GameObject that is attached to head of my playermodel to match the same direction as my Player Variant so that the player camera is facing completely straight.

I've attached two screenshots to hopefully show what I mean.

I managed to get the Z rotation solved with an external script

float z = transform.eulerAngles.z;
transform.Rotate(0, 0, -z);

But I'd like to replicate this in playmaker and also match the Y rotation so its the same as the player model, I just don't understand much code and it seems like a complex process to understand for my brain.

I feel I'm on the right track with euler angles, but definitely a noob and could be very wrong.

Thanks!

GMPlay

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Setting same angle as top level parent
« Reply #1 on: October 08, 2022, 09:04:54 AM »
Don't know if this will work in your case, but try actions such as Get Rotation, Set Rotation.

If this isn't what you seek, then you could also look into Tween Rotation action. If you are using Tween then you may need to set the Time to minimum possible value to make it look instantaneous.

The reason why I am suggesting Tween action is because you will not have to worry about Euler, quaternion etc. These things are taken care automatically within these actions if you set these actions correctly.

I use them sometimes even for the simplest of the tasks because the way these actions work makes the workflow a bit simpler. But that's just me.

Simmehh

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Setting same angle as top level parent
« Reply #2 on: October 08, 2022, 10:01:44 AM »
I just tried these before I saw your post and it did exactly what I wanted :)
Quaternion and Euler did weird things to the camera controller and messed around with movement so I disabled those.

Thank you for the reply!