I’ve been working with BodyVelocities lately, and I noticed that inserting a BodyVelocity with a script into the HumanoidRootPart makes the player lose control completely. BodyVelocity thrusts the player forward in one direction, therefore the player cannot turn and proceed in another axis. Is there a strategy to enable movement whilst having a BodyVelocity in the player?
You can get a glimpse that I’m trying to turn with a BodyVelocity. It’s orientating me, but not moving me in the direction I am facing. Evidently from the block code above, I am missing something, but I’m not quite sure if there is an efficient way to check a player’s (with a BodyVelocity) direction.
That’s more than likely cause you’re only changing the Velocity property once, I mean you could put it through a loop and make it work that way instead I believe
while true do
wait()
BodyVelocity.Velocity = Humrp.CFrame.lookVector * 10
end
I personally don’t think this is the best way to approach it, but it’s just an example
Yeah while loops are extremely nonoptimal considering that you’re updating the Velocity constantly. I’m looking for any other way to be able to turn without looping through one Velocity.
It’s not as bad as you think it is. You could probably use BodyForce or BodyThrust, but it will be much harder to control than BodyVelocity. I would just set the velocity of the BodyVelocity on heartbeat.
That’s a good approach, but the BV is currently on the server. Also there would only be 4 axis (left, back, front, right) and if a player were to move diagonally it would be impossible?