How to make knockback relative to the player position?

How can I make my knockback relative to the vector in-between the player and the victim?
Here’s a preview of what I’m trying to achieve ;

image
Realisticly, the dummies should move like this.

But my code uses lookVector as the velocity so the results end up like this:
image

How can I replicate the first image in code?

1 Like

You can use something like Part:ApplyImpulse()
I’m pretty sure it uses Vector3.

What you need is a normalized direction vector (a vector with a length of 1).
let directionVector = normalize(playerPosition - dummyPosition)
Now you can use this direction vector and multiply it with a number to create a velocity vector.
let velocityVector = directionVector * knockbackVelocity

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.