Answered by
5 years ago Edited 5 years ago
LookVector, RightVector and UpVector
UpVector
returns a direction facing upwards of a CFrame, RightVector
returns a direction facing the right of a CFrame, and LookVector
returns a direction facing forwards of a CFrame.
These are returned as Vector3's and are normalized, meaning that they have a magnitude approximately equal to 1; have used .Unit
on them
These can be used for:
Propelling a character forwards:
Suppose you want a player to propel themselves forward or in any other direction with a small force. You can use:
1 | local bv = Instance.new( "BodyVelocity" ) |
3 | bv.Velocity = player.Character.HumanoidRootPart.CFrame.lookVector * 50 |
4 | bv.MaxForce = Vector 3. new( 1 , 1 , 1 ) * math.huge |
5 | bv.Parent = player.Character.HumanoidRootPart |
7 | game:GetService( 'Debris' ):AddItem(bv, 1 ) |