I’m looking for a method to lock the player character’s Z and X axes when they step in water, while keeping the Y axis free for regular directional movement, to create a more realistic swimming and wading mechanism - the intended effect is for the character to swim upright. By the way, using a custom rotated swim animation doesn’t exactly work (I can explain if needed.)
I’ve tried using a couple methods, notably such as AlignOrientations, but none seem to work. My attempt as is follows:
local Attachment=Instance.new('Attachment')
Attachment.Parent=char.HumanoidRootPart
Attachment.Name='SwimAttachment'
local LV=Instance.new('AlignOrientation')
LV.Parent=Attachment
LV.RigidityEnabled=true
LV.Enabled=true
LV.Attachment0=Attachment
LV.Attachment1= PartAttachment
LV.Mode=Enum.OrientationAlignmentMode.OneAttachment
game:GetService('RunService').Heartbeat:Connect(function()
if Attachment
then
LV.CFrame=CFrame.Angles(
0,
char.PrimaryPart.Orientation.Y,
0,
)
end
end)
So, does anyone have a fix or an alternative method? This issue relates to the default humanoid swimming state, which should honestly be toggled in the first place.