playMaker

Author Topic: Rotating on the Z Axis to Face Objects  (Read 2038 times)

ConceptMotion

  • Playmaker Newbie
  • *
  • Posts: 1
Rotating on the Z Axis to Face Objects
« on: November 22, 2013, 02:52:09 PM »
So, I've been struggling with this issue for a few days. I am building a top down 2D game (using 2D Toolkit) and basically I want to have a sprite face another sprite by rotating on the Z axis (I also need the player sprite to look at the mouse, which is part of the same problem). However, the sprites are designed top down; facing the top of the characters head, so the "face" of the character is actually on the sides facing the X and Y axes (the vertical axis for the game world is along the Z axis). So, when I try to use PlayMaker, or custom scripts to rotate the sprites towards objects, it rotates the front (the top of the head facing the Z axis) towards the objects, which turns the sprites sideways and making them look flat. Is there anyway around this?
« Last Edit: November 22, 2013, 04:38:25 PM by ConceptMotion »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rotating on the Z Axis to Face Objects
« Reply #1 on: November 28, 2013, 06:03:24 AM »
Hi,

 yes, simply attach your sprites to an empty gameObject with its z axis properly oriented. then the sprite inside that dummy will have it's face in the z axis direction of its parent, and have the parent do the look at job.

 Bye,

 Jean