playMaker

Author Topic: [Solved] Look At 2d but Direction instead of GameObject?  (Read 1186 times)

serenefox

  • Full Member
  • ***
  • Posts: 135
    • Serenefox Games
[Solved] Look At 2d but Direction instead of GameObject?
« on: September 13, 2018, 03:29:39 PM »
Hi,

I am trying to get my 2d sprite to look at a direction, but it won't work properly. The lookat 2d action works but I need to to look at a Vector 2 direction instead of just a V2 point in space. Any ideas? I tried smooth look at direction but the sprite keeps flipping around the wrong way not matter what up vector I have.

Thanks!
« Last Edit: September 14, 2018, 07:40:59 PM by serenefox »
Most Recent Published Games:
Juicy Theater - Android

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15496
  • Official Playmaker Support
Re: Look At 2d but Direction instead of GameObject?
« Reply #1 on: September 14, 2018, 02:09:11 AM »
Hi,

 You can get the direction by substracting your target position with your sprite position?

Meanwile, I'll if I can make that action.


 Bye,

 Jean

serenefox

  • Full Member
  • ***
  • Posts: 135
    • Serenefox Games
Re: Look At 2d but Direction instead of GameObject?
« Reply #2 on: September 14, 2018, 10:44:39 AM »
Hi Jean,

I am getting the direction from the “Get axis vector” action. I just need to feed that direction into a “look at” action some how so my arrow sprite will point that way. The problem I am having isn’t getting the direction, it’s that I can’t figure out how to get the look at to work properly.
Most Recent Published Games:
Juicy Theater - Android

serenefox

  • Full Member
  • ***
  • Posts: 135
    • Serenefox Games
Re: Look At 2d but Direction instead of GameObject?
« Reply #3 on: September 14, 2018, 07:40:08 PM »
Nevermind I figured it out. I used a dummy parent game object and manipulated that with the smooth look at direction which I did before but apperently not the right way. For 2D I had to change the child object’s rotation to be 270 in the X, 0 in the Y and 180 in the Z.
Most Recent Published Games:
Juicy Theater - Android