Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i use CFrame.LookVector in a BodyVelocity?

Hey there! I'm making a script where you can dash in the direction you are looking at, but does anyone know how to do this? I'm not asking for a script, but just an explanation on how to do this. Thanks for reading!

1 answer

✓ Accepted answer

dude. you have it right there. just set the BodyVelocity to the LookVector. since the LookVector is a unit vector (1 stud length) and Velocity is studs per second, multiply it by studs per second. then turn it off when you don't need it anymore, e. g. if you wanted to travel 20 studs at 10 studs per second then turn it off after 2 seconds.

that said, you might not want a BodyVelocity. that just gives a constant speed, which could be exactly what you want, but you might also want a more realistic dash that slows over time. in this case you can find out how to use a VectorForce instead.

2 comments

0

Setting the BodyVelocity to the LookVector was the first thing i tried before making this question, but it didn't work well. The vector force should help. Thanks!

0

that's strange. in that case, even if you use a vector force you'll get the same issue. may I ask how you are getting the lookvector?

This discussion is preserved as it was. New answers, comments, and votes are closed.