Sign in to follow this  
Icebone1000

My cubes keep equilibrating on 1 or 2 vertices(on floor)

Recommended Posts

Icebone1000    1958
Its freaking weird..I can see that the collision data is ok, since it collides perfectly against my half planes( Im confining the cubes on my screen limits), It doesnt penetrate also(it jiggles a bull a lot, not worrying about that now), I alredy have set lots of stuff to minimize freaking behaviors( my COR is 0.01, my angular and linear damping is 0.5(for velocity and ang velocity), my box is 1.28m diameter, 10kg, gravity 9.8, I set my inertia tensor diagonal for ridiculous 200,200,200, it just slows down the issue, but it still happens )

I have an iterative contact solver, impulse based, that solves penetration(nonlinear projection) first then velocity, it solves the contact with greater penetration/velocitychangeNeeded first, updating affected contacts, and than again until theres no more contacts to solve or the iterations limit is active..

Now my problem..At first doesnt look I have a problem, it seems perfect for spheres, but for cubes I think all the problems is in the rotations..
The first thing I notice, is the fact that a cube falling straigh down on the floor, will have a little rotation when it collides, it shouldnt since it is perfectly aligned, so I wonder if this is alredy a problem or just imprecision stuff..Its not so worrying because few moments later it stop bouncing and accomodates on the floor(looks realistic, because its freaking hard to make a cube falls perfect aligned on real word)..

The bigest problem happens when I apply forces on the cube that make it rotates( forces like on a volume dial(up right ->, down left<-), just to make it rotates). If I manage to change the side(face) of the cube that touches the floor, it will never rest its 4 vertices on it, it will freaking equilibrates on 2 or even on 1 vertice!(something that if I would want to make Id never achieve the same results), it feels like theres balloons attached to it..its weird because if I manage somehow to make the original face to face the floor again, than it will rest again(no baloons behavior)...

Heres when it first collides againt the floor, not it orientation changes when it shouldnt:
[img]http://i16.photobucket.com/albums/b29/0o--Karnage--o0/cubesAtImpact-1.png[/img]


Heres it resting fine few moments after the pic above:
[img]http://i16.photobucket.com/albums/b29/0o--Karnage--o0/cubesrestingOK.png[/img]


Heres it equilibrating after I rotate:
[img]http://i16.photobucket.com/albums/b29/0o--Karnage--o0/equilibrating.png[/img]


It "dances" for a while until get on a perfect equilibrium, so it stay like this just like on a perfect resting..
The number on the center is the number of contacts..

I stucked on this for 3 days alredy, I compared my contact solver code with the one in the book Im basing me on(game physics engine dev), I compared every damn line and it seems the same..I dont know where to look for or how isolate the problem. (I feel like trowing the notebook against the wall!)

I alredy tried remove completely the penetration solving part, I think the same behaviour happens, but is hard to tell since the cubes starts to sink in the floor immediatly..If I increase the COR so it will bounce enought to make it not penetrate, it never stops bouncing, sometimes it gatter more velocity until "explodes", disappearing..

The code for the contact solving proccess is about 500 lines, so I dont know what to post...Any guess? T_T

Share this post


Link to post
Share on other sites
Icebone1000    1958
Hey..I hosted the executable and its needed resources(textures etc.) on google docs( did anyone know google docs can host anything? o.o)..
Heres the link:


(DX11 only(level 10))
[url="https://docs.google.com/leaf?id=0B_iN9pcbyoiKOTBiM2Y1MzktOWYwZi00MTE1LWIzMGMtY2M4ODkzN2ExNmE4&sort=name&layout=list&num=50"]https://docs.google....out=list&num=50[/url]
Its a .rar file..
To check the problem just rotate the cube about Y by pressing left shift or left ctrl(this will apply forces that will make it rotate) after it rest on the floor, you will notice it will start to jump..
On the screen you can see the transformation matrix, orientation quaternion, rotation( aka angular velocity), position and number of contacts(on that order)..
Just in the case one might be in the mood to help me ¦D..

This really just happens with cubes, I can rotate a sphere as much as I want and it will not happen...I still have no clue.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this