Kinematic Bodies[Solved]

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Kinematic Bodies

Postby Dave Gravel » Sat Mar 02, 2019 2:48 pm

Yes thanks it seen to work now.
I have think it don't work because the collisions don't work all the times.
https://www.youtube.com/watch?v=e8cz52cOxFs

The collision result don't work very good for me.
I have try to update the velocity and matrix but the collision result is wrose in my test.
Maybe I do it wrong.

Edited:
It don't collide all times, when the kinematic body have no mass the collision result look stronger.
When the kinematic body have mass it seen to fail more about the collisions.

This is what I get with mass zero and with mass 1.0
https://www.youtube.com/watch?v=YUJ7BAslTL0

The autosleep is disable but the collision seen to work only when I interacting with the bodies.
I have set some velocity for make move other bodies, but my velocity value is not good.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Kinematic Bodies

Postby Julio Jerez » Sat Mar 02, 2019 5:10 pm

I does look wrong, I will try to make a test liek that to see what is going on.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Bodies

Postby Julio Jerez » Sun Mar 03, 2019 10:12 pm

Ok MeltingPlastic and Dave, I added a new demo called KinematicBody.

teh idea is to place ther few platform sthe move fallowing different path, and that that will interact with dynamic bodies.

but before we move on, I wnat you guy to see the set up. this was the exact same set se up that the game Ship Simulators used to place physics bodies on the ship.
The have their own simulation for the ship wich was a static collsion tree.
at teh time is was newton 1.5 so we have to go over few trial until we got to the set up that now is formalized with teh listener.

I also realized that I keep asking people to use listeners no realizing that there was no a base class interface in teh custom joint, so I moved to the dCustom joint.

this is a standard cpp class quiet eassy to use for thsi kind of things.

It is important that we undertand who thsi works, because on Newton this is how things work best if people wnat want to take advantage t the engine architecture.

so please when you read this sync and look at demo: ../demosSandbox\sdkDemos\demos\KinematicBodies.cpp

before we move on.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Bodies

Postby Dave Gravel » Sun Mar 03, 2019 10:34 pm

Good for me and I have already the listener class implemented.
I have see the demo and for the moment I understand good.

The kinematic body is supposed to generate a static collision by default ?
Because here the kine body seen to generate a static collision, sometime it behave strange but in general it working ok.

I have add a dyn box in your demo and the platform don't seen to generate any collision.
If i'm not wrong with the kinematic body you need to generate the good velocity when you move it.

I have remove the rotation in your demo and the platform don't seen to generate the static collision.
I try to understand why it happen in my demo and why in your demo it don't seen to happen.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Kinematic Bodies

Postby Julio Jerez » Sun Mar 03, 2019 11:15 pm

Oh do not worry about adding a body, for now.
I just want we all to be in the same page.

It is possible there my be bug that are carting over from when I added the collision optimization.
But those can be fix eassylly,

The import part is that the system is set up correctly.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Bodies

Postby Dave Gravel » Sun Mar 03, 2019 11:33 pm

I think to have it working like you, with pretty similar syntax.
In my system I need to add mass on the kinematic body because it don't take care about the omega when the body have zero mass.
https://www.youtube.com/watch?v=5CtO4pF6uuk

Edited:
Ok I have find why in my system it don't work with mass zero.
It's because normally my object system don't set the transform callback when the mass is zero.
It is fixed now for the kinematic body.

Hum no something don't work good for me.
In your demo you don't set any mass.
I have fix the problem to get the kinematic matrix in the transform callback but when the mass is zero the matrix stay always at the identity state.
If I set the mass to 1 the matrix start to become updated in the transform callback.

This video show my problem.
https://www.youtube.com/watch?v=GQZEUTMZaog
You can see the kinematic body is read from the callback but when mass is zero the matrix stay at identity state.
It is updated only when mass is over zero.

Edited 2:
Forget it, I have update my dll and now it work correctly with zero mass.
Cool.

Thanks.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Kinematic Bodies

Postby Julio Jerez » Mon Mar 04, 2019 5:28 am

no I have not added mass to those yet, thsi will be demostrate later, for now is basic funtionality.

yes yo unee to update I am fixing the problem as I find them, I made that the NewtonBodyIntegrateVelocity operate on kinematic whether teh have mass of not.
This was how it was in teh pass because Kinematic can after that function, so it has to be updated.

tshi patform souel be a transparent patform that onle sence objects, I nwo see teh first bug, the bodies are some time passing trough and some tiome the colide with it, this is a bad bug that I need to fix first.

you can see that teh box first pass trough the transparent platform, then then platform start colliding with it and this is wrong.

the platform should make a contact joint and calculate the closet point, then tshi can be use in the pre of post listen to do stuff on the bodies interaction wit the kinematic.

This is the first stuff than I need to fix.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Bodies

Postby Dave Gravel » Mon Mar 04, 2019 6:14 am

I'm not sure if it can help to find the bug, but if you only add one box it never collide.
You need to add more object to get some collisions.

Edited:
The bug look like some contact point is not present with only some objects.
When you add more object it seen to have more contact point for generate the collision.
Sometimes the box size seen to affect the problem too, some size seen to give better collision result.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Kinematic Bodies

Postby Julio Jerez » Mon Mar 04, 2019 8:01 am

Oh do no worry about this is a bug is the engine.
I am jsut setting the demo, so that you guy can see how it progresses step by step.
this way is no that complicated to set it up when is finally working as is support to.

I now set it do that when a Box is in contact with the platform it should before red.

this is no happing, the but first pass though it, the after a while is before red, and keep colliding.
It seems more than one bug.
anyway I am now ready to debug it an see what is wrong.

This is been broken for some time I think. but is has to work.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Bodies

Postby JackMK » Mon Mar 04, 2019 10:16 am

It looks like it works for persistence broad phase but not for default broad phase.
JackMK
 
Posts: 2
Joined: Mon Feb 18, 2019 8:04 am

Re: Kinematic Bodies

Postby Julio Jerez » Mon Mar 04, 2019 10:26 am

ok I found teh fort bug here
Code: Select all
const dgInt32 kinematicTest = !((isBody0Kinematic && isBody1Kinematic) || ((isBody0Kinematic && body0->IsCollidable()) || (isBody0Kinematic && body1->IsCollidable())));

it should be
Code: Select all
const dgInt32 kinematicTest = !((isBody0Kinematic && isBody1Kinematic) || ((isBody0Kinematic && body0->IsCollidable()) || (isBody1Kinematic && body1->IsCollidable())));


That fixes the intermittent problem, it does not fixed the problem of the joint generation the pair but only the closest point. it is this feature that makes kinematic bodies interesting act as triggers volumes. I will check how the trigger volume does it because I believe teh Archimedes Buoyancy demo does works.

if you sync you will see the kinematic acting as a static body.
for MeltingPlastic is should work now.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Bodies

Postby Julio Jerez » Mon Mar 04, 2019 10:31 am

JackMK wrote:It looks like it works for persistence broad phase but not for default broad phase.

do you have an older version? the persistence broad phase is now called dgBroadPhaseSegregated.cpp

but I beleive is broken in both cases, It may be teh case that for Segragate bradphase is less frequent because that broadphase separate dynamics and static boides so the bolea test may pass the part that is dynamics as a long as the dynmaics body was not sleeping.

but anyway I am revisiting the complete funtionality.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Bodies

Postby JackMK » Mon Mar 04, 2019 11:05 am

newton.png
newton.png (242.15 KiB) Viewed 7903 times
JackMK
 
Posts: 2
Joined: Mon Feb 18, 2019 8:04 am

Re: Kinematic Bodies

Postby Julio Jerez » Mon Mar 04, 2019 11:21 am

Oh I see, in the menu they are still, name persistence.
Still the bug apply to both.
If you see, the line that prevent the joint from coming,
The secondbooleant test was using the state of body zero, but is just happen that for persistence broadphase body zero is always the dynamic one so that check was always false.
This make the test about 50% more likely to pass and for the joint.

The test should pass 100% of the time.

But that was a good observation.

We are not trough yet, if for example a body goes to sleep close to the platform, the platform will miss it, because kinematic bodies are static body that goes to sleep immidially after they a matrix update, so I have to find that place and make sure it check for that condition. That's the second bug.

All this happen because of the optimization I did last year. Is not a big deal, I just forget.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Bodies

Postby Dave Gravel » Mon Mar 04, 2019 1:48 pm

It seen to work ok for me too.
https://www.youtube.com/watch?v=D9QU1myc2DE

Just the other bodies don't seen to wake up with the kinematic body, Like you have say upper.
The normal collision seen to work good now.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 4 guests