-
What do you want to achieve?
Make the Bodygyro cframe face the direction that it is facing and complete my plane landing system. -
What is the issue?
my BodyGyro seems to set it’s own cframe to 0,0,0 even if I set it manually using a script
https://gyazo.com/eb549691532f19cb6927646aeb78e3b9 -
What solutions have you tried so far?
I have tried setting it manually using a script to no avail. I’ve looked in the devforum but no one seems to have the same problem as I have but I am not sure.
local RunService = game:GetService("RunService")
local Direction = Body.CFrame.LookVector
local BodyVelocity = Instance.new("BodyVelocity",Body)
BodyVelocity.MaxForce = Vector3.new('inf','inf','inf')
BodyVelocity.P = 2000
BodyVelocity.Velocity = Vector3.new(0,0,0)
local BodyGyro = Instance.new("BodyGyro",Body)
BodyGyro.P = 5000
BodyGyro.D = 1000
BodyGyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
BodyGyro.CFrame = CFrame.new(Direction)
local Speed = Body.Speed
local Velocity = Vector3.new()
local PitchSpeed = Body.Pitch
local RollSpeed = Body.Roll
local YawSpeed = Body.Yaw
local Yaw = Body.YD
local b = Body.CFrame.LookVector.Y
Yaw:GetPropertyChangedSignal('Value')
YawSpeed:GetPropertyChangedSignal('Value')
local TurningSpeed = VehicleSeat.TurnSpeed
Yaw.Value = b
wait(1)
RunService.Stepped:Connect(function(time,deltaTime)
BodyGyro.CFrame = BodyGyro.CFrame * CFrame.Angles(math.rad(PitchSpeed.Value * -VehicleSeat.Throttle),math.rad(Yaw.Value +YawSpeed.Value),math.rad(RollSpeed.Value * -VehicleSeat.SteerFloat))
Direction = Body.CFrame.LookVector
Velocity = Direction * Speed.Value
BodyVelocity.Velocity = Velocity
end)
end)