You can write your topic however you want, but you need to answer these questions:
I need an accurate knockback system that looks really smooth and such without being too taxing considering lag and such.
I can’t really figure out what method to use, I found a really good code sample that simulates a very good trajectory, but the problem is that it moves way too fast.
I’ve tried almost everything, including gravimetric equations and just simple body velocities but nothing really looks good or it doesn’t work
this is the code I am using right now, if there was a way to just keep this same thing but just slow down the character it would be perfect
local height = 70
local distance = 200
local originpart = player.Character.HumanoidRootPart
local movepart = char.HumanoidRootPart
local Angle = ((movepart.Position - originpart.Position) * Vector3.new(1, 0, 1)).Unit * distance + Vector3.new(0, height, 0)
movepart.Velocity = movepart.Velocity + Angle
Anyway my main goal is to keep the same trajectory whilst slowing down the movement of the character, plz help ;-;
When you say “knockback” do you mean a physical sort of “push” in the opposite direction?
yes like how being hit by a powerful attack would push you away.
It should be as simple as
(movepart.Position - originpart.Position) * velocity) and then using a BodyForce’s .Force property whilst parented to the HumanoidRootPart of the Character.
Hold on lemme try that real quick
Also don’t forget to do
wait() and then
BodyForce:Destroy() otherwise the thing affected will go flying off into the distance.
Umm, it doesnt rlly work too wel O-o
As seen in my first video I want it to travel in an arc similar to the jumping mechanic, bodyvelocities only move in a straight line unless you tween them or something
Hmmmmm. Ok so, after doing some looking through old files. I found some code that I wrote, which works pretty well.
local BodyVelocity = Instance.new('BodyVelocity', HumanoidRootPart)
BodyVelocity.Velocity = Vector3.new(((originpart.Position.X - movepart.X) * 100000), math.random(750000, 1000000), ((originpart.Position.Z - movepart.Z) * 100000))
Humanoid.Jump = true
You can muck around with the numbers and see if you can get something looking good. This code was originally a forcefield sort of thing.
Thanks the arc looks really good, just messing with the numbers rn, the direction is a little off but is easily fixable with lookvectors and such. hope this works and thanks for the help!
No problem I’m glad it’s working now