Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I adjust the orientation of a roblox character when flying?

Asked by 5 years ago
Edited 5 years ago

Hi all! I'm currently working with BodyMovers in a fly script and I'm trying to adjust the orientation of the roblox character when flying. You can tell from the gif that the character is leaning to the right a bit, rather than being centered. I'm not sure if its something I can adjust with what I already have, or if there's a missing property in the script that I need. I'm relatively new with BodyMovers, but if anyone could suggest on how I could adjust the orientation a bit, it would be a huge help!

Here's a tid-bit of what I have:

function Fly() 
    local BodyGyro = Instance.new("BodyGyro", Torso) 
    BodyGyro.P = 9e3
    BodyGyro.maxTorque = Vector3.new(9e9, 9e9, 9e9) 
    BodyGyro.cframe = Torso.CFrame 
    local BodyVelocity = Instance.new("BodyVelocity", Torso) 
    BodyVelocity.velocity = Vector3.new(0,0.1,0) 
    BodyVelocity.maxForce = Vector3.new(9e9, 9e9, 9e9) 
    repeat wait() 

and here's the current flight example in action: https://gyazo.com/fe11d644197129f56f1be73613951967

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

This can be caused by changing the CFrame of the BodyGyro to the camera angle instead of the Torso CFrame, I think. Something like this:

local cf = game.Workspace.CurrentCamera.CFrame
BodyGyro.CFrame = cf

Please tell me if I'm wrong.

0
Yes!! Thank you so much! firelexy 7 — 5y
Ad

Answer this question