Unusual "jitter" while hit

AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Unusual "jitter" while hit

Post by AxeD »

Hi,
I have found strange issue. When I throw a ball with some speed (let's say 400 in demo) and this ball hits pins (made from cylinders), some pins are "shaking". This same may happen when pin hits to a gutter.

Any ideas?
Best
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Unusual "jitter" while hit

Post by sparkprime »

When, how, and for how long are they shaking?
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Unusual "jitter" while hit

Post by sparkprime »

I made a bowling video although the ball is not going very fast: http://www.youtube.com/watch?v=ityh8GhyHQo

If I made the ball go at 400, probably it would just shoot straight through as I'm using DiscreteDynamicsWorld.

The ball has radius 0.5 and you can guess how big the pins are. They aren't cylinders though:

Code: Select all

compound {
        // head
        sphere {
                centre 0 0 .88;
                radius 0.16;
        }
        // neck to waist
        cone {
                centre 0 0 0.435;
                radius 0.27;
                height 0.83;
        }
        // waist (so it rocks nicely)
        sphere {
                centre 0 0 0;
                radius 0.31;
        }
        // bottom
        cylinder {
                centre 0 0 -0.315;
                dimensions 0.38 0.38 0.63;
        }
}
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Unusual "jitter" while hit

Post by sparkprime »

How large are all of your objects, and to what are you setting friction, restitution, damping, sleeping threshold, etc.

At what resolution are you stepping the simulation, and have you changed any of the solverinfo parameters?
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: Unusual "jitter" while hit

Post by AxeD »

Hi,
my parameters are:
(normal sizes multiplied by 100. But I have tested factor 1, 4, 10). Values below are already multiplied by 100
ball - btSphereShape - 11.00f
lane - w,h,l - 60f, 30f, 1800f
ball speed ~ 60 - 100 with gravity -10.0
restitution - 0.0f; - other values tested
friction - 0.3f;
sleeping treshhold - default
stepping - 1/30, 2 - checked 1/30, 1; 1/30, 2, 1/200 and no change

There was no change in solverinfo parameters. Pins are shaking for a very long time(I have never checked it)
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Unusual "jitter" while hit

Post by sparkprime »

Are you seeing a completely unrealistic "fitting" behaviour or are the bowling pins just rocking in a normal fashion (but not eventually coming to rest)?

I don't understand how you are stepping the simulation, did you say you have tried

stepSimulation(d,n)

where d is in { 1/30, 1/200 }

and n is in { 1, 2 }

The "d" parameter is supposed to be the elapsed time as measured by you, the client programmer, with some kind of timer function. It is the 3rd parameter - the internal step frequency, that you should be trying 1/200 with. The middle parameter is not so important for a realistic simulation, I'd argue it's less important than the 3rd parameter. It's only useful to avoid the performance getting out of control. So do something like

stepSimulation(seconds,10,1.0/200);

where seconds is the number of seconds since you last called stepSimulation.
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: Unusual "jitter" while hit

Post by AxeD »

Hi,
I know how to use "stepSimulation" and I'm checking simulation with fixed time-step. This "jitter" looks like one of an Angular velocity parameter would change a sign from frame to frame.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Unusual "jitter" while hit

Post by sparkprime »

you could try increasing numiterations in the solverinfo structure and also playing with the angular damping?
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: Unusual "jitter" while hit

Post by AxeD »

sparkprime it looks like You have something wrong here:

Code: Select all

compound {
        // head
        sphere {
                centre 0 0 .88;
                radius 0.16;
        }
        // neck to waist
        cone {
                centre 0 0 0.435;
                radius 0.27;
                height 0.83;
        }
        // waist (so it rocks nicely)
        sphere {
                centre 0 0 0;
                radius 0.31;
        }
        // bottom
        cylinder {
                centre 0 0 -0.315;
                dimensions 0.38 0.38 0.63;
        }
}
Sphere cannot have smaller radius than bottom cylinder - right ? In solver info i have checked values 20, 100, 300 and no change. Angular factor is reducing that jitter but not enough
Last edited by AxeD on Fri Aug 15, 2008 3:36 pm, edited 1 time in total.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Unusual "jitter" while hit

Post by sparkprime »

Oops I forgot to mention i changed the definition of cylinders and boxes so that "dimensions" is lengths and diameters, not half lengths and radii
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Unusual "jitter" while hit

Post by sparkprime »

Can you record a video of the shaking behaviour? A long sequence of png files (one per frame) is enough for me at least. I can make a video from that using mencoder very easily.
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: Unusual "jitter" while hit

Post by AxeD »

This jitter occures on a Wii console. On PC I haven't seen this :/ but i'm still working on PC reproduction. Currently i'm using gravity -1000 for a ball and linear velocity in Z around 700.
Last edited by AxeD on Sun Aug 17, 2008 1:37 pm, edited 1 time in total.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Unusual "jitter" while hit

Post by sparkprime »

Can you try any of the bullet demos on the wii?
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: Unusual "jitter" while hit

Post by AxeD »

I have tried some simulations with balls and boxes. Everything looks ok. But in my test i have to use big objects and i have issues as follows:
1. Ball is flying to far and it's bouncing even if restitution is 0.0f for a ground and ball. So i have to use gravity -1000.0 which gives me issue below.
2. I have to upscale force for a ball.
3. I have to create collision shapes from primitives.

However there is no matter if collision object is a primitive(upto 5 elements) or a mesh, this jitter occures
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Unusual "jitter" while hit

Post by sparkprime »

Gravity is usually 10m/s/s so 1000cm/s/s should be ok as long as your balls radiuses and velocities etc are also in cm. You can make the bowling lane out of triangle meshes but all dynamic rigid bodies have to be convex or compounds of convex shapes. Moving triangle meshes around could result in the behaviour you describe. Assuming by "upscale the force" you mean the initial impulse that models the "throwing" of the ball. Multiplying that by 100 should give you the right acceleration assuming you don't change the mass. This is making me wonder whether the internal impulses used to push objects away when they collide are on the right scale, however.

I'm suprised that changing the internal step size or the number of iterations doesn't fix the problem, as throwing more CPU cycles at the problem has fixed every simulation quality problem I have encountered so far.