3D Snake Game Physics

Hello, I’m making a 3d Snake Game and I am having a little trouble with the physics.



Currently I am using a ragdoll type system, where the segments of the snake follow the head, and then I set the head’s speed and rotation directly via setLinearVelocity on it’s rigidBodyControl. So I think that’s probably not the best way to do it as it doesn’t mesh well with the terrain.



So I was thinking I could make the body segments frictionless as a possible solution, or I could apply a force to the snake’s head instead of using setLinearVelocity, or I could switch to a modification of character control for the head, though if I do that will the ragdoll physics still work? Can you make rigidBodyControl connections to a character control object or will it cause problems?



Here’s a picture of the snake. It still needs some work, but the scales look pretty awesome.

EDIT: Though it’s hard to see how awesome they look in the picture :confused:



http://s18.postimage.org/3nbzpybm1/snake.jpg



EDIT: here’s a better picture!



http://s11.postimage.org/5cst4cnsj/snake.jpg

Yeah, you can try frictionless or just continuously setting the linearvelocity of the head, the rest sould sort itself out then.

1 Like
@normen said:
Yeah, you can try frictionless or just continuously setting the linearvelocity of the head, the rest sould sort itself out then.


I do set the linearvelocity of the head every frame but it doesn't work. I'll try frictonless segments.

Also, who rated you down for that? I gave you a thumbs up :P

I have fans who like to spend their time on me :wink: (and don’t care about the confusion for others when a correct answer by me is thumbed down)

activate thumb shield

1 Like

I try to thumbs up @normen and it just said Pling!

@zarch said:
I try to thumbs up @normen and it just said Pling!

Yeah, would be unfair if you just can't thumb me down eh? ;)

Life isn’t fair. :evil:

It’s working a little better now.



Uh, if the snake ever bends a lot (I guess to the point of passing it’s joint turning radius? Or maybe so that a segment from a few segments down gets inside another segment) it explodes and all the pieces fly around at extreme speeds in such a manner that I have no idea what they are doing.



Any ideas?

Segments inside each other would certainly generate some serious repulsive forces if they are all physics objects…

Yeah, you can set that per bone, if their parents should collide when directly connected.

@zarch said:
Segments inside each other would certainly generate some serious repulsive forces if they are all physics objects...


Okay, so I probably need to tweak the turn angle per joint depending on the width versus length of the segments so that they cant turn into eachother or something.
@normen said:
Yeah, you can set that per bone, if their parents should collide when directly connected.


Well, I think I already have that set. I think this is the next segment after the adjacent one that is colliding and causing problems.
@snakeman said:
Well, I think I already have that set. I think this is the next segment after the adjacent one that is colliding and causing problems.

Then you might want to change the layout, it greatly influences the physics effect ofc. Constraining the joints probably makes sense, yeah.