but I wanted to use the new BodyMovers instead since the old ones are no longer supported, but for some reason the force isn’t being applied to the Character.
This is the code within my Constructor function, I parent the force to the BodyFrontAttachment instead of having to make my own attachment
self.Force = Instance.new("VectorForce", self.Character.UpperTorso.BodyFrontAttachment)
self.Gyro = Instance.new("BodyGyro", self.RootPart)
self.Magnitude = 90
self.Mass = 0
for i,v in pairs(self.Character:GetDescendants()) do
if v:IsA("BasePart") then
self.Mass = self.Mass + v:GetMass()
end
end
self.Force.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
self.Force.Force = Vector3.new()
self.Force.ApplyAtCenterOfMass = true
I then detect when the player is pressing E and call this method
--Vector = (Hook.Position - Gear.RootPart.Position).unit
function module:SetForce(Vector)
self.Force.Force = Vector * self.Magnitude * self.Mass
end
I read the wiki, and the force only needs direction and magnitude but it’s not working:
Coincidentally, I’m trying to work with VectorForces right now as well. First of all, increase your magnitude to be at least above 150 for a decent speed. Secondly, set every part in the Character’s friction value (in CustomPhysicalProperties) to 0.01
Right now, I’m trying to figure out how to make it so the speed doesn’t crazily increase after jumping, but there’s probably not a good solution for that.
Yeah, I’m feeling like moving back to BodVelocity, because VectorForces seem to be an atrocity for what I’m trying to do right now, anyways I’ll do it thanks!
EDIT: Yeah it didn’t work at all, what’s really going on, I’m kinda annoyed at this point.
Something you’ll want to do at the very start when working with character forces is to change the Humanoid’s StateType to Physics via the function Humanoid.ChangeState. This will prevent the humanoid from applying force and will instead be reliant on what you apply.
Sorry for the necrobumping. I did some tests and found that to prevent the speed from increasing crazily after jumping. For this you need to reduce the magnitude of VectorForce and the Density property in CustomPhysicalProperties.
I calculate it like this:
Density = Magnitude / 1666.6666
In my case (jump and gravity have default parameters, the character is not affected by external forces) I set the magnitude to 50 and the applied force does not increase or decrease sharply.