Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Gav (HeyBud) on September 16, 2018, 07:54:56 PM

Title: How do you move toward a vector position using force? [SOLVED]
Post by: Gav (HeyBud) on September 16, 2018, 07:54:56 PM
If I want to move a physics2d game object to a desired x and y how do I know how much x and y to apply force to move in the direction of the object? Is there an easy way to do this? ??? Similar to Move To action but physics based.
Title: Re: How do you move towards a vector position using force?
Post by: heavygunner on September 16, 2018, 08:10:16 PM
Maybe with iTween Move To with Setting time ?
Title: Re: How do you move towards a vector position using force?
Post by: heavygunner on September 16, 2018, 08:41:16 PM
That would be great, but I think I tween move uses translate and not physics force. Am I wrong about that? The problem I'm having is when you translate, collisions are overridden or something. Only using force can you get good physics collisions.
I am beginner to Playmaker.
I don't get what you saying.

I faced a similar issue while started to learn. Found solution here
http://hutonggames.com/playmakerforum/index.php?topic=19365.msg84383#msg84383

:)
Title: Re: How do you move toward a vector position using force?
Post by: Gav (HeyBud) on September 17, 2018, 11:11:57 PM
Yeah, that makes sense. So I guess my question is a math question. how do I calculate the vector i need to plug into 'set velocity' to move in the direction of another position? I want an object to move to another object using physics.  This would be a super useful custom action!



I'm not good at maths.
Title: Re: How do you move toward a vector position using force?
Post by: jeanfabre on September 18, 2018, 02:48:26 AM
Hi,

 to get a direction, you substract the target position with your current position, that's your direction.

 you then use that as the base vector to apply your force.

 Bye,

 Jean
Title: Re: How do you move toward a vector position using force?
Post by: Gav (HeyBud) on September 22, 2018, 08:20:23 PM
This works thanks. It felt like I was over-complicating the question so i'm glad there's a simple solution.