Collision Bug?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Collision Bug?

Postby FSA » Sun Aug 04, 2013 10:55 am

Hi! I have three problems. The first: Many bodies falling through the gorund. I don't know why. In the video you can see the problem:
https://www.dropbox.com/s/zlbr8wljipunkmb/IMG_0828.avi

The second: The player jumps a little bit (also in the video, this little flicker in the scene). Why ist that so? Newton version ist 3.11 an the latest sync.

Third: I have created a player like in the demos and walked a little bit around in the scene from the video. After about one minute NewtonCrashs with this error:

My configuration: 1 meter = 1 unit, Gravity: -10
Sorry that I have so much questions :(
Attachments
Crash.JPG
Crash.JPG (34.13 KiB) Viewed 4014 times
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Collision Bug?

Postby Julio Jerez » Sun Aug 04, 2013 11:59 am

the first bug, if they are not too fast or they are regular size then that is a real bug

if they are too small or they going too fast?
then they need the Continue collision option
void NewtonBodySetContinuousCollisionMode (const NewtonBody* const body, unsigned state);
can you print the velocity and size.

for the secund bug it Is just an assert that I place there to see when a the collision test start on bad position.
you can ignore it.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Bug?

Postby FSA » Sun Aug 04, 2013 12:12 pm

The velocity of the lowest body, which doesn't collide, right before the ground is -13.96. The size of the box ist 0.8x0.8x0.8 units (80cm).

Whats about the third bug?
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Collision Bug?

Postby Julio Jerez » Sun Aug 04, 2013 1:05 pm

13.9 m/s at 60 fps is abput 0.23 meters.
I should not pass the ground floor, are yo udoing thsi onthe sand box demos?

can you after the creation of the scene call this function
void NewtonSerializeToFile (const NewtonWorld* const newtonWorld, const char* const filename);
the try loading on teh sand box and see if it works, if it fail then ou cna send it to me for debuguing


My respond to teh secund but was in fact the answer to teh third bug, teh assert is no a crash, t simple say that teh playe god into a position where all movomen result into a slight penetration.
In theory this shpuld never happens if the player moves from a legar state to a another legal state.
this is why I put teh assert.
In reality this deos happens because, for two reason.
1- physic engines operattes with descrete time step. this simular to quatum mechanic where the smaller time is the Plank time and particle actually
dematerialize from one state and rematerialize on the next step. A descrete simulation does similar.
we try to predict what happen in between, but because all physics algorithm are linearization of a non linear proccesses, it is possible the the prediction actually give positive false.
2- numerical error with floating points. some time when a shape hit anoeth shape with large dimentions, the algorth use too many bit of eth matiza to hold the infomation of teh large shape leaving no enught bits to acularrallu caocule correct contact and normal points.

Like I said it does no matter becaus the assert sodul recover. I palce there as an indication that IO nee to fix that.
bacasilly that function should has being filete put bu a previus one but I have no writen it yet.


the secund Bug, is realate to the playe try to step on small bodies.
I still do not knwo hwo to treat that, every one have a diffrent options.
Bacially step objects are passing as star steps an dte paley try to jump on them bu teh teh collsion moves the and next step teh play land.

I need to add a filter to resolve that small debree collsion, but first I need to know what the user want the player to do.
if yo uhave an idea of what you want the player to do tell my. I am happy to add it.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Bug?

Postby FSA » Sun Aug 04, 2013 1:53 pm

Also in the Sandbox some bodies fall through the ground. But less bodies as in my application. File is in the attachement.

Too the player. My ideas are the following:
Either you can set the behavior at creation. Like a boolean if the player should step over dynamic bodies or not.
Or another solution, probably the best for my self: The user can create an own Callback or filter where he get the body which collides with the player and can decide if the player should step over it or push it. When two or more bodies collide an array of bodies would be good.
Example:
Code: Select all
bool StepCallback(NewtonBody* pBody)
{
    // for instance when the body is static, step over it (return true)
    // and when it is dynamic return false to push it(just simple example)
    if(BodyIsDynamic(pBody))   
        return true; 
    else
        return false;
}
Attachments
Serialize.zip
(22.83 KiB) Downloaded 175 times
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Collision Bug?

Postby FSA » Sun Aug 04, 2013 3:57 pm

Whoops sorry. In my comment was a big failure :D It is correct now
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Collision Bug?

Postby Julio Jerez » Sun Aug 04, 2013 4:29 pm

Oh gald is good now, what was wrong?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Bug?

Postby FSA » Sun Aug 04, 2013 5:00 pm

No I meant in my sample of the player callback one post before. The collision bug is still there. :(
Have you also noticed the bug with the serialization file in your sandbox?
And what do you mean about my example fot the player controller?
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Collision Bug?

Postby Julio Jerez » Sun Aug 04, 2013 5:43 pm

not I am not in home now, I will test it tonight or tomorrow morning.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Bug?

Postby Julio Jerez » Mon Aug 05, 2013 10:42 am

Ok I just tested the serialized file, and I see what the problem is

the floor is no a polygonal mesh it a paper thin convex hull.
In newton convex hull are meant to have volume, that convex hull passed the volume test only because the plane is so large that the two size in fact have a non zero volume.
Those kind of degenerated shapes generate lot of numerical error.

when I set the FPS to 120 the test pass without problems, but at 60 it fail the reason is that when the penetration tes is going to be calculated the contact point on the op[site side of the floor, so they are colliding b the engine doe sno have information to
determine in what direction the contact soul point too,

you can do tow things:
1- use a polygonal mesh for floor
2- make the floor a thicker convex hull


as for the player, yes I will add the callback for the player to decide if should step of small object or just stops an go around
should the player ever move other bodies?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Bug?

Postby FSA » Mon Aug 05, 2013 10:50 am

Ah ok. The second option worked for me. And what is about my idea for the player controller filter?
Tank you!
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Collision Bug?

Postby Julio Jerez » Mon Aug 05, 2013 10:51 am

I just edited the other post, I will add the filter.

That will be by the weekend, I have few pending things to complete first.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Collision Bug?

Postby JoeJ » Mon Aug 05, 2013 12:23 pm

Julio Jerez wrote:should the player ever move other bodies?


I'm no user of player controller, but to make it most flexible, maybe it's good to do a callback for any body that comes in contact?
Then the user knows all contacting bodies (which is always good), and can return some options for each:

Moving Behaviour (example for behaviour walking over bridge from demo):

1. Move the body without slowing down the player
(bridge receives responce from player - player may push bridge down and follows due to gravity,
but bridge can't get back up because player is static obstacle - bad for this case)

2. Move the Body but slow player down by mass / force ratio
(dynamic interaction between player and bridge in both directions - nice)

3. Never move the body
(bridge does not start to swing - ok but boring for this case)

Stepping Behaviour :
1. Step over if possible - else try to move
2. Try to move - else try to step over
3. Never step over (so try to move)

The default option would be 2. each for my taste.
I still have doupts it's possible to make a player controller that works good in any case and makes everyone happy :)
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Collision Bug?

Postby JoeJ » Mon Aug 05, 2013 12:45 pm

One other thing comes into my mind is experience with actual games (which is more about static enviroment but worth thinking about).
Good example: Dishonoured - movement always smooth and perdictable, look how smoothly you go under a desk or climb on rooftops / pipes.
Bad examples: ROTT, Deadpool, even Bioshock 3: Poor and unpredictable behaviour with small obstacles. If you make a step, camera teleports up the whole height - I hate this.

Lots of this has to do with camera... maybe it's a good idea to provide smoothed gfx matrix, where you can attach camera or player model.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests