# playMaker

### Author Topic: How do you move toward a vector position using force? [SOLVED]  (Read 403 times)

#### Gav (HeyBud)

• Full Member
• Posts: 117
##### How do you move toward a vector position using force? [SOLVED]
« on: September 16, 2018, 04: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.
« Last Edit: September 28, 2018, 11:20:28 AM by Gav (HeyBud) »

#### heavygunner

• Full Member
• Posts: 146
##### Re: How do you move towards a vector position using force?
« Reply #1 on: September 16, 2018, 05:10:16 PM »
Maybe with iTween Move To with Setting time ?

#### heavygunner

• Full Member
• Posts: 146
##### Re: How do you move towards a vector position using force?
« Reply #2 on: September 16, 2018, 05: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

#### Gav (HeyBud)

• Full Member
• Posts: 117
##### Re: How do you move toward a vector position using force?
« Reply #3 on: September 17, 2018, 08: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.
« Last Edit: September 17, 2018, 09:47:54 PM by Gav (HeyBud) »

#### jeanfabre

• Hero Member
• Posts: 14244
• Official Playmaker Support
##### Re: How do you move toward a vector position using force?
« Reply #4 on: September 17, 2018, 11:48:26 PM »
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

#### Gav (HeyBud)

• Full Member
• Posts: 117
##### Re: How do you move toward a vector position using force?
« Reply #5 on: September 22, 2018, 05:20:23 PM »
This works thanks. It felt like I was over-complicating the question so i'm glad there's a simple solution.