How to make limited snake movement like in slither io

What do you want to achieve? Keep it simple and clear!

The Current Movement:

What i want to make it like:

i want to create a movement like slither io, but in this case im using the HumanoidRootPart as the snake controller. Since the character can move freely without certain limits as shown in the video, i dont have any ideas on how to limit the characters movement like in the slither io example. How do i make a limit so the snake wont touch itself like in slither io.

thanks for your response :coefficients:

3 Likes

try vehicle in roblox. the control method is more like driving a snake than just walk around.

1 Like

creative idea but it uses wheels so how could i mimic that kind of effect?

i would try set the wheel part transparency=1 to hide the wheels

are there any other ways than using a vehicle?

you could update the snake’s position only while a movement key is down, and you would have a unit vector dictating what direction the snake is moving in. Every time the snake moves, it should move in that unit vector. To change the unit vector, you could have the WASD keys lerp the unit vector towards the direction of the input. Doing this should produce a gradual turning effect like in the video

I actually have done something similar for the leviathans in my game:

I did this using something called procedural animation, I’ll share the script when I get home

But basically, this utilizes the fact that if you, for example, turn the HRP 25 degrees on the Y axis, if you turn the Motor6d on the tail -25 degrees (the opposite direction), itll be facing the same way as if the HRP didn’t turn at all.

Multiply this degree offset by the difference between rotations between the rotation on the last frame and the rotation on the current frame, and clamp it to -0.25 → 0.25 to prevent tail curling, and decrease the effect for body segments closer to the HRP, and you’ll get the tail turning effect you want :slight_smile:

1 Like

thanks :+1: i will try to make it

this is also good i will try, to make it using your way

sorry can you give me an example i cant seem to implement that idea, im still confused, i think i should learn more about it.