userInputService.InputBegan:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.One and not gameProcessedEvent then
SubRootPart.RotationGyro.CFrame = CFrame.Angles(0, 0, 0)
SubRootPart.CFrame = SubRootPart.CFrame * CFrame.Angles(0, SubRootPart.CFrame.Y, 0)
end
end)
When the user presses one, the models orientation is reset. This works perfectly fine, however, how would I keep the models yaw from being reset?
userInputService.InputBegan:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.One and not gameProcessedEvent then
SubRootPart.CFrame = SubRootPart.CFrame * CFrame.Angles(0, 1, 0)
end
end)
would work, all this should do is multiply roll and pitch by 0 making them 0 (resetting it) while multiplying yaw by 1 keeping it the same
if inputObject.KeyCode == Enum.KeyCode.One and not gameProcessedEvent then
local LookVector = SubRootPart.CFrame.LookVector * Vector3.new(1, 0, 1)
SubRootPart.RotationGyro.CFrame = CFrame.new(SubRootPart.Position, SubRootPart.Position + LookVector)
end