I’m woking on a combat system where you can perform comboes by combining different moves, however, most of the comboes depend on a knockback system to work. I’m used to BodyVelocities when making knockback systems, but I wanted to change my habits and start using VectorForce. Everything is working smoothly when testing on dummies, because the values of the VectorForce has been tampered with to match the length needed for comboes to be performed. When performing the same comboes on live-players they seem to fly either too far or too close. I’m almost positive this is because of the fact that I am using custom morphs with different masses/weights. How can I account the morphs mass so it flies the same length regardless of which morph is being knocked back?
Multiply all the forces by the total character mass. Here’s how to get the total mass: How to get total mass of a model? - #3 by GeneratedScript
Like so?
VectorForce.Force = Vector3.new(0 * Mass, (UpValue or 0) * Mass, -Force * Mass)
There still seems to be a huge differece.
The first and third print is of the dummies masses, and both of them are different morphs.
Often when working with humanoids, they can grip the ground and forces aren’t applied to them. You can make the characters jump, platform stand, or sit, which will disconnect them from the ground. If there still is an issue, then the timing of the enabling and disabling of the vector force could be off. This is why linear velocity is useful with characters, as it provides enough force to move them, but limits the speed.
Setting all of the parts of the custom rig to massless true and then adjusting the forces based off of that should work.
yeah it is
xdxdxdxd ;-;-;-;-;-; ;-;-;-; ;-;-;-; ;-;-;-;
Use a function that gets the entire mass of the character model
function getMass(model)
assert(model and model:IsA("Model"), "Model argument of getMass must be a model.");
local mass = 0;
for i,v in pairs(model:GetDescendants()) do
if(v:IsA("BasePart")) then
mass += v:GetMass();
end
end
return mass;
end
Using this, you can multiply it by a constant. You will have to tweak this constant once, but after that, all characters should behave the same.
Edit: pass the character model to the function
local character = ...
local totalMass = getMass(character)