playMaker

Author Topic: "iTween Look To" in 2D  (Read 2554 times)

Demonocrat

  • Playmaker Newbie
  • *
  • Posts: 14
"iTween Look To" in 2D
« on: September 05, 2013, 09:39:58 AM »
Hi!
I'm trying to make my character to face the enemy I click on in 2D game on XY plane.
So to do it i have to rotate him on Z axis, right?
So i make action like this:


First i made it with simple 2D toolkit sprite and it was rotating anywhere but not to the target I was clicking on, despite me changing it's pivot point.

Then I tried to create empty game object and attaching it sprite to it. After some trial and error i managed to make this:
https://googledrive.com/host/0B0f16VnG1h4TN2VTRm53dUFYY0k/Example.html
(click on character in the middle, then on one of the cubes to rotate)

But as you can see it refuses to rotate to the left.
It looks like I'm using "Rotate To" wrong.

Maybe I need to use some other action to achieve what I need?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: "iTween Look To" in 2D
« Reply #1 on: September 11, 2013, 08:21:13 AM »
Hi,

 I suggest you start on a clean dummy scene. with two cubes. Then you can work out how to use iTweenLookAt properly and apply it back ( knowing it works, so if you have problem in your implementation, then you need to look outside this action for the problem)

 keep me updated on your progress.

Bye,

 Jean