A way to simulate character rotation?

Heya,

I wish to simulate rotation of your character, I’ve noticed that default roblox movement makes you do a 90 degree angle lets say when turning slowly. I want for the time it takes for your whole body to turn in direction you walk to be less.

I’ve tried exploring bodymover methods but apart from that I’m not sure how you can do this.

An example is how in 2D games your character turns to a direction instantly but in 3D games your character does this slowly in favor to look smooth.

local userInput = game:GetService("UserInputService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera

local debounce = false

userInput.InputBegan:Connect(function(key, processed)
	if processed then return end
	if debounce then return end
	
	if key.KeyCode == Enum.KeyCode.Q then
		debounce = true
		character:PivotTo(character:GetPivot() * CFrame.Angles(0, math.pi / 2, 0))
		camera.CFrame *= CFrame.Angles(0, math.pi / 2, 0)
		task.wait(0.1)
		debounce = false
	elseif key.KeyCode == Enum.KeyCode.E then
		debounce = true
		character:PivotTo(character:GetPivot() * CFrame.Angles(0, -math.pi / 2, 0))
		camera.CFrame *= CFrame.Angles(0, -math.pi / 2, 0)
		task.wait(0.1)
		debounce = false
	end
end)

The rotations are bound to the Q and E keys.

1 Like

Thanks a lot! Didn’t even know PivotTo was a thing!