Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Demonocrat on September 05, 2013, 09:39:58 AM

Title: "iTween Look To" in 2D
Post by: Demonocrat 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:
(https://api.monosnap.com/image/download?id=Dt4tTLTuMkqC36oieE360Ft1n)

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?
Title: Re: "iTween Look To" in 2D
Post by: jeanfabre 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