Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Splankton on October 20, 2019, 01:35:36 PM

Title: Moving a 2d object in a forward direction
Post by: Splankton on October 20, 2019, 01:35:36 PM
Hi, I've searched this through the forum and can't seem to find the right answer for me.
 
All I need is to point an object at a target (used look At) and need to use set velocity 2d or add relative force 2d, to move the object in its forward direction. And I can't get it to move forward.  I know there must be a simple solution to this... Can someone help?
Title: Re: Moving a 2d object in a forward direction
Post by: hoyoyo80 on October 20, 2019, 08:40:34 PM
Forward direction? Any other detail? Are you making 8 direction game? Or SideScroll?
Title: Re: Moving a 2d object in a forward direction
Post by: rechronicle on October 21, 2019, 12:52:40 AM
Maybe using 'Move Towards' action to move the object into anything it looks at.
Title: Re: Moving a 2d object in a forward direction
Post by: Splankton on October 21, 2019, 03:43:31 AM
Forward direction? Any other detail? Are you making 8 direction game? Or SideScroll?

I want it to move in directions to the left and right side, so I have it facing the target, I just need it to move in the facing direction using add force 2d or add velocity 2d.  I can only move in either the x or y, not the facing forward direction.

Maybe using 'Move Towards' action to move the object into anything it looks at.

Yes that works but I need to use physics as the object needs to bounce off of walls etc.
Title: Re: Moving a 2d object in a forward direction
Post by: hoyoyo80 on October 21, 2019, 10:18:35 PM
If it is only left and right as you said, u can:
1.Get current facing direction of the sprite via scale value
2.Apply positive or negative X direction force base on 1