ContactCallback without using physics?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: ContactCallback without using physics?

Postby Beauty » Tue Mar 31, 2009 10:58 am

For my application I use Newton only for collision detection. Physics functions aren't used.
This works fine (especially with the improvements of Newton 2).

But in this context I don't understand:
Why a body needs a mass > 0?

If I don't define a mass or set the mass to 0 then collision detection doesn't work.
In my eyes this makes no sense.
Is this a bug?

I wasted much time to find out the reason, why collision detection didn't work.
It is very confusing and I suppose that also other users can have this problem.
I think it would be better to "remove" this depency.

For physics functionality the mass makes sense.
But if somebody doesn't use physics and instead he uses
NewtonBodySetMatrix(...) for position/orientation changes
and NewtonCollisionUpdate(World)
then it would be nice if the collision detection works (without mass).

Internally you could set flags to bodies (moved by NewtonBodySetMatrix(...)) and check the flags when NewtonCollisionUpdate(...) is called.
Mogre user
User avatar
Beauty
 
Posts: 30
Joined: Tue Apr 29, 2008 7:37 am
Location: Germany

Re: ContactCallback without using physics?

Postby Julio Jerez » Tue Mar 31, 2009 11:49 am

Beauty wrote:For my application I use Newton only for collision detection. Physics functions aren't used.
This works fine (especially with the improvements of Newton 2).

But in this context I don't understand:
Why a body needs a mass > 0?

If I don't define a mass or set the mass to 0 then collision detection doesn't work.
In my eyes this makes no sense.
Is this a bug?


the collision only funtionallity is a by product of the physics funtionality.
the engine have five basic phases.

broad Phase
norrow phase
bode assembly,
reation force calculation
integration

the collison only execute the first two.
that means the scene still have to be a valid physics scene.
if it was not, then you may run into cituations with illegal shapes colliding.
for example say you have a shape that is static form the collision only point of view, but is is dynamics from the dynamics point of view,
this will force the engine to have two diffrent structures to maintan since the dynamics body may overlap more adjacent cells than the static one.
it will also foc eteh engien to have different coherance cashes since the dynamics body may have list of close shapes, but if it was also static then it would not need those list.

I beleive NewtonSetMatrix will work if the movable bodies have a non zero mass. Are you saying the this is no right?
and this are not the only problems.

why is this a problem setting a mass to a non zero value, you can see the mass as a flag the specify if a shape is static or movable, this is no differnt than having a different flag,
but it is much easy to support since the collison is a subpart of the full physics it just needs a separate loop.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: ContactCallback without using physics?

Postby Beauty » Tue Mar 31, 2009 12:34 pm

Thanks for the detailed explanation!

Julio Jerez wrote:I beleive NewtonSetMatrix will work if the movable bodies have a non zero mass. Are you saying the this is no right?
and this are not the only problems.

After I set a mass to the bodies it works.
My problem was that I didn't get the thought that a mass is needed.

Julio Jerez wrote:why is this a problem setting a mass to a non zero value

Generally it's no problem, but if somebody doesn't know it then collision detection doesn't work.

Julio Jerez wrote:you can see the mass as a flag the specify if a shape is static or movable, this is no differnt than having a different flag

That's right.

In the Ogre wiki I'll write about this important thing.
Also it would be good, if this depency is also documented on other common place (e.g. in documentation; or add a comment line to the source of a related example application; or write this to a collision related page of the Newton wiki)
Mogre user
User avatar
Beauty
 
Posts: 30
Joined: Tue Apr 29, 2008 7:37 am
Location: Germany

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron