playMaker

Author Topic: Rotate (local axis only) to face direction of movement?  (Read 3570 times)

frogwise

  • Playmaker Newbie
  • *
  • Posts: 49
Rotate (local axis only) to face direction of movement?
« on: May 04, 2015, 07:16:59 PM »
Hey all,

I've been struggling with this one for a little bit now.

My game looks like the image below. The player moves from left to right based on just hitting the space bar (direction is inversed) while traveling downwards at a constant speed. All I'd like to do is have him "face" the direction of movement. I've tried Smooth Look at Direction, and Rotate, but the problem I seem to be having is I cant get the proper rotation axis to work.

To complicate it further, as you can see from the right panel in the image, my character is on a slight angle so that he can be seen better from the camera. So what I'd need to do, is to rotate and face him around his LOCAL axis only.

I've seen all kinds of wonky facing directions so far, but can't seem to nail this intended behavior.

Thanks in advance!

DaiDesign

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Rotate (local axis only) to face direction of movement?
« Reply #1 on: May 04, 2015, 10:06:06 PM »
Have you tried adding your character to a Game Object and have that Game Object rotate. The Game Object would be aligned to the floor of your game. Place your character as a child of that Game Object. You can then if you wanted to, rotate your character on his local axis to rotate forward and backwards as if speeding up or slowing down.
If I'm right, you don't won't to rotate on the characters local axis as this would look weird.

frogwise

  • Playmaker Newbie
  • *
  • Posts: 49
Re: Rotate (local axis only) to face direction of movement?
« Reply #2 on: May 05, 2015, 12:16:06 AM »
I think you misunderstood the issue - i actually do need to rotate him on his own local axis (as seen in the right image panel) so that he looks like hes traveling in the direction of movement (as per the arrows in the first panel). He never needs to rotate forward or back.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Rotate (local axis only) to face direction of movement?
« Reply #3 on: May 05, 2015, 07:11:14 AM »
It's commonly handled by adding a 'wrapper' empty gameobject as a parent that has a flat local axis which is more straightforward to manipulate and all of the child objects will flow it, of course, so the problem kind of solves itself therein.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D