Get vector that is opposite point knowing the middle and starting one

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

Push away the players hit by a pulse wave, but need the vector and direction.

  1. What is the issue? Include screenshots / videos if possible!

I don’t know how to get the vector needed to apply Force to a BodyForce to move a player in this situation.


Red: Boss, Gray: Pulse wave, Green: Players, Orange: Vector.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Yes, I did, but couldn’t find something exact enough for my problem.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

I know how to apply force to something, I’ve already done before, but can’t figure out how to get the vector that is the opposite point from the boss (Center) and the player being the mid point. Any mathematical information you can give me will help. Sorry if my english is too bad.

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

What you can do is find the vector from the player to the boss (Boss position - player position). This is the opposite of the vector you’re looking for, so simply multiply it by -1 to get the vector you want. Then add this new vector to your player’s position and you’ll have the Vector3 you’re looking for.

1 Like

Seems pretty logic, will try it out creating a dot in the position and see if worked

1 Like

Creates a dot in the place but is a completely different place, tho variates a bit depending if I were hit behind or in front of the boss, what I’m doing wrong?

dot.Position = game.ServerScriptService.WhoIsBoss:
Invoke().HumanoidRootPart.Position - human.Parent.Head.Position

That’s only half of the work; (Boss - Player) is just the vector from the player to the boss. Next you need to add the negative of this vector to the player’s position.

local vector = game.ServerScriptService.WhoIsBoss:
Invoke().HumanoidRootPart.Position - human.Parent.Head.Position
local negativeVector = -vector
dot.Position = human.Parent.Head.Position + negativeVectr

Try that

2 Likes

Thx! Also, I was making it negative (Didn’t wrote the whole script, sorry) but forgot to add it to the player position, makes sense because the point was being generated next to the spawn!

1 Like