Snake created from balls

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Snake created from balls

Postby rattus » Tue Aug 31, 2010 9:32 am


i'm trying to create flying "snake" from bunch of spheres connected by Ball and socket.

Problem i have is that "tail" - spheres after first - should just follow head, but the tail is still affecting the head - dragging it when head changes direction.

I tried to set low mass, play with limits, stiffness but cannot seem to find correct solution.

My idea is to have tail spheres have no inertia so it would just follow.

Can someone please kick me in the right direction ? ( maybe play with massmatrix differently than just by mass )

code looks something like this
Code: Select all
Vector3 size = new Vector3( 0.5f, 0.5f, 0.5f );
float mass = size.x * size.y * size.z * 2.5f;
if ( i != 0 ) {
mass = 0.002f;

                ConvexCollision col = new CollisionPrimitives.Ellipsoid( Game.World, size, _currentInstance );
                col.CalculateInertialMatrix( out inertia, out offset );
                inertia = inertia * mass;
                Body body = new MogreNewt.Body( Game.World, col );

                body.SetMassMatrix( mass, inertia );
                body.IsGravityEnabled = false;

BallAndSocket joint = new BallAndSocket( Game.World, body, lastBody, pos );

joint.Stiffness = 2f;
joint.SetLimits( Vector3.UNIT_Z, 0.8f, 0.8f );

Posts: 7
Joined: Tue Aug 31, 2010 9:20 am

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests