Kia ora!
This is my first time using AlignOrientation and AlignPosition. I am used to BodyGyro and BodyPosition lol.
Here’s what my system looks like:
As you can see, the system behaves as intended until the player travels in one direction, stops, and then travels in the same direction again.
I don’t believe that this issue stems from my code as the ReferencePart (highlighted in the video) has the same orientation when the rotation is as attended and when it is not. This can be seen in the unfotunately hard to read output in the above video. My instance tree is below, where Body is the part that is attached to the ReferencePart. The ReferencePart is controlled by the movement script.
Here is the controlling code:
local movementConnection = runService.RenderStepped:Connect(function()
if #keysPressed > 0 then
startMoving()
table.sort(keysPressed)
angle = keyWeights[table.concat(keysPressed)]
else
stopMoving()
end
local cframe = CFrame.new(character.PrimaryPart.Position)
* CFrame.Angles(0, math.rad(angle), 0)
* CFrame.new(0, 0, -speed)
character.PrimaryPart.CFrame = cframe
* CFrame.Angles(math.rad(forwardRotation), 0, 0)
end)
Does anyone have an inkling as to why the rig’s rotation behaviour is strange after initiating the same movement as before the movement comepletely stopped?