1

**Playmaker Help / Re: AddForce2D to Target World Position**

« **on:**February 03, 2018, 06:42:21 PM »

Hello again,

I'm writing to let you know of the solution I found to this. I used your advice, Jean, but the only way I could get it to work right was to essentially calculate the slope of the line between the player and the target. I used the target position for x1 and y1, then said if x2 was x1 multiplied by a force factor, what would y2 be. It was easy to figure out the slope and position of x2 and y2 from there.

Aside from working through the slope equation using variables, I also had to apply Impulse rather than Force. It just gave better results considering what I was looking to achieve.

Oh, and finally, I had to increase iterations in the Physics 2D Settings, to keep the hinge joints from separating so much when the force was applied. All of that combined gave a nice result. See attached for a quick look at the FSM.

Here's a quick video of the force being applied. I need to tweak the force factor just a bit, but It's nearly there: https://youtu.be/312BeMqf2ho

Thanks so much for your help with this. I really appreciate the Playmaker community!!!

I'm writing to let you know of the solution I found to this. I used your advice, Jean, but the only way I could get it to work right was to essentially calculate the slope of the line between the player and the target. I used the target position for x1 and y1, then said if x2 was x1 multiplied by a force factor, what would y2 be. It was easy to figure out the slope and position of x2 and y2 from there.

Aside from working through the slope equation using variables, I also had to apply Impulse rather than Force. It just gave better results considering what I was looking to achieve.

Oh, and finally, I had to increase iterations in the Physics 2D Settings, to keep the hinge joints from separating so much when the force was applied. All of that combined gave a nice result. See attached for a quick look at the FSM.

Here's a quick video of the force being applied. I need to tweak the force factor just a bit, but It's nearly there: https://youtu.be/312BeMqf2ho

Thanks so much for your help with this. I really appreciate the Playmaker community!!!