Jump to content
  • Advertisement
Sign in to follow this  

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

This topic is 2775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:

Heres it resting fine few moments after the pic above:

Heres it equilibrating after I rotate:

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
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))
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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!