playMaker

Author Topic: Rigidbody 2D face direction it is travelling.  (Read 2012 times)

_adamturnbull

  • Playmaker Newbie
  • *
  • Posts: 18
Rigidbody 2D face direction it is travelling.
« on: March 24, 2014, 04:45:43 PM »
Hi,

Currently I set the velocity of my character at the beginning of the level and then let physics do the rest as it rolls down ramps and whatnot. Is there a way to make sure it always faces the direction it is travelling.

It is a 2D game so only needs to look left or right.

Thanks!
Adam

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Rigidbody 2D face direction it is travelling.
« Reply #1 on: March 24, 2014, 08:16:51 PM »
Here is one of the ways, you can getvelocity and if it is positive you use a float compare to tell if less than 0 left event, more than 0 right event. The event that it sends it to can be set to flip it in the direction that you want.
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

_adamturnbull

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Rigidbody 2D face direction it is travelling.
« Reply #2 on: March 25, 2014, 11:19:14 AM »
Thanks, I'll try that. Are there any other ways or is this the best?

Is there a way to only send an event once if it goes below or above 0? Because won't it constantly keep sending the 'positive' or 'negative' events every frame.

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Rigidbody 2D face direction it is travelling.
« Reply #3 on: March 25, 2014, 02:03:56 PM »
I am sure there are other ways which hopefully someone else on the forums can help out with but for the below or above 0 you set two states that link to each other. If its below send to left state if it is above you make the left state send to right.
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez