Hello everyone,
I’m making a custom explosion module and I’m wondering. How can I apply force to the character based on their position inside the explosion.
for example , if the player is on the left the force applied would be to the left and so on.
How would I achieve this?
1 Like
You can use CFrame.LookVector
which is what i use for body movers
This is what i would do:
--Create body velocity and edit it to your liking
BV.Velocity = HRP.CFrame.LookVector * -intensity --Its negative to send the person backwards.
This is relative to that persons position, so it might not work as truely intended but it should be a good start
If you have any questions, please let me know!
from what I know Body movers are deprecated so I’m trying to use HumanoidRootPart:ApplyImpulse()
1 Like
You can still use my line of code, LookVector counts as a vector3 aswell **
1 Like
Obtain the vector between two position points.
Starting from the center of explosion towards the players position.
In lua this would look like this
local blastDirection = player.Position - explosion.Position
local unitizedDirection = blastDirection.Unit -- male the length equal to 1
Video explaining the topic:
2 Likes