Humanoid While Swimming Undocumented Behavior

I built a custom NPC of a four legged animal and use Humanoid:MoveTo to move it around. This is a large animal, much bigger than your standard character.

The problem is when the NPC swims, the head points straight down, and the tail of the animal sticks out of the water. I assume this is an undocumented humanoid behavior meant to change the orientation of the character while swimming (and was probably meant only for bipedal characters).

Is there anyway that I can compensate, so that my NPC is horizontal?

1 Like

This isn’t undocumented or unexpected behaviour, the Swimming state is behaving exactly how it should. Irregardless of what character model you’re using, the character is rotated forward that way while swimming. For a humanoid character, it’s rotated and it gets its “horizontal” positioning from animations.

Your animal model is rotating the same way a standard Humanoid character would. So your solution is to add an animation that changes the orientation of the model or change Joint CFrames. You shouldn’t force the Humanoid upright, because that itself will produce unexpected behaviour with the Swimming state.

4 Likes

Detect humanoid state change using StateChanged event.

If the new state is swimming, reorientate everything relative to your root part (rotate the weld if it’s a weld constraint, or use an animation), and likewise if the new state is anything other than swimming, go back to the default orientation.

I’d try to make the transition smooth by either tweening or using animations.

1 Like