What I'm trying to do is have a part move forward, and down at the same time. The problem is that I want it to move forward in the direction the part is facing, same thing with the down force.
This is part of an airplane.
1 | script.Parent.BodyVelocity.Velocity = (script.Parent.Main.CFrame.lookVector*Speed) -- The forward speed |
Simply add the two Vector3s representing your velocities together:
1 | local forward = Vector 3. new( 0 , 0 , 10 ) |
2 | local down = Vector 3. new( 0 , - 10 , 0 ) |
3 |
4 | BodyVelocity.Velocity = forward + down |
In this example, the sum of the two Vector3s will create a velocity of Vector3.new(0, -10, 10)
.
Or more specifically to your case:
1 | local forward = Main.CFrame.LookVector * speed |
2 | local down = Vector 3. new( 0 , - 10 , 0 ) |
3 |
4 | BodyVelocity.Velocity = forward + down |
CFrame.lookVector contains 3 values so obviously you cant change the entire velocity to the CFrame lookVector , you can only change x and z, y you have to change manually since the humanoidrootpart's lookvector will always be -0 unless you angle the body somehow