Kinematic and dynamic body: interaction?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Kinematic and dynamic body: interaction?

Postby Enclave » Sat May 04, 2013 7:52 pm

Here is many topics about kinematic & dynamic bodies interaction, i have read them all, but did not find the solution.

I am using the NGD core 3.00 in my game project.

It uses the Player Controller for player and other NPC's (enemy's). --->>> They are Kinematic bodies.
Also i have some boxes (stacks) at my level location. --->>> They are Dynamic bodies.

The problem is that is no interaction (collision) between kinematic and dynamic bodies in a Newton core 3.00. I read here that is correct, but i need this interaction,
because my player and NPC's want push, pull, and move boxes and boxes stacks.

Also, a have a barriers from stack of boxes (they also the dynamic bodies) in my level map, but player passes through them without any collision.

Please see the video describes what i mean. (this is not a my project, but a need the same)




What is the solution? Some examples, how to do this?
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Sat May 04, 2013 9:18 pm

can you make a small video of how it behaves in your project?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Sun May 05, 2013 2:50 pm

It will be a little difficult, because i made some refactoring in a project, and not everything is working yet. I need a time to finish.

I am sorry, there was a small mistake about collision.

Videos in the first message shows what happens when a player pushes boxes.
The boxes are moved, the player can climb on them, and if they move, it does not penetrate into the player.

From 1:19 in a video shows what happens when the boxes falling down on enemy. The enemy moves and falls.


1) When a player moves into the box, then there is a collision, and the body can not penetrate each other. This is ok!
2) When the boxes is moving in the player, then there is no collision. This is not ok for me, the body should be also colliding.
3) The player cannot move boxes. This is not ok for me, I need to move them.

The dynamic world better than static! :)

Attachments
1.jpg
1.jpg (169.13 KiB) Viewed 5473 times
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Mon May 06, 2013 7:13 pm

Oh I see now. Yes I have to resolve that problem.
I need to deside if I am goig to make kenematic bodies collidable or not. maybe an option.

Let me see if I can work on that this weekend after I get the Linux stuff out of the way.
that way I can focus only on engine features.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Tue May 07, 2013 2:41 am

I've seen here that many people ask about this problem. If you make a kinematic bodies collidable (option or some way), this will be a really good deal!

Currently the player can not move anything, for example, we have the door, that is a dynamic body with Hinge joint, and the player wants open it by pushing. It is impossible for now. (((

In a Newton 2.00 these things was more simple, because the player body was a dynamic. I have compile the tutorial with old player controller, it works good!
It would be nice get the same with Newton 3.00 :idea:

Why you decide change the player from dynamic to kinematic body in a Newton 3.00?
Maybe it's a good idea to change the player body back from kinematic to dynamic.
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Tue May 07, 2013 7:58 am

Enclave wrote:If you make a kinematic bodies collidable (option or some way), this will be a really good deal!

yes adding the option to make kinematic body collidable can solve some of these problems.
right now for kinematic bodies there are tow options
1-make the generate intersection (this is the fastest, and the main meaning of a trigger) basically the act as a use variable in the scene that indicate if a body is penetration them of not
2-generate contacts (here the generate the contact joint, but they are no part of the contact resolution.

adding the option collidable is no that simple, because kinematic bodies and dynamics bodies are different kind of classes, the dynamics phase of the engine only deal with dgKenematioc bodies, therefore making work with kinematics bodies
will add a lot of conditional test to see if it can how to tread that object. but I guess this si the best solution

Enclave wrote:Why you decide change the player from dynamic to kinematic body in a Newton 3.00?
Maybe it's a good idea to change the player body back from kinematic to dynamic.

because I want to try the kinematic body functionality, I suppose I can make then dynamic body, and that solve the problem for the player only, however again it is no that simple
the player now is aware the he is a kinematic body so it is no concerned with other bodies applying forces to him. this simply the code a lot
I will see if adding the third option, help to fix this issue and if not them I will make the player a dynamics body again.
but again I do no think that making is a dynamics body is as easy as it sounds.

the reason for this is that dynamics bodies have lot of information the relate them to other bodies. the player basically work by changing his position directly,
I will have to go back to the method of moving it by changing it velocity so that other bodies are notified of his motion.
anyway I am working this week to fix those tow issues.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Tue May 07, 2013 11:11 am

Ok I added that option now

void NewtonSetBodyCollidable (const NewtonBody* const body, int collidableState);

now when you make a kinematic body you can call that function and the body will behave like a static body that can move.
now the player controller by default call that function and.
in the advance player controller when I step in the hanging bridge, it add very nice, the bridge move as if the player is applying weigh on it.

this is because ther play has a velocity, and the bridge is simple reacting to that impulse.
I still do no know if this is desirable or not, you test it a let me know.

if you Sync to SVN you do no have to do anything jut build and run.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Tue May 07, 2013 1:21 pm

Thanks, Julio.

The demo program is not work.(

I try run the precompiled version sandbox, the basic controller demo running ok, but nothing happens, (no objects, only player) and when i tried switch to an advanced player controller demo, the program fail. :(

Also i can't make a build, because i am using VS2008 Express, but the solution file for her does not contain wxWidgets folder, only Fox.
I cannot use solution file for full version VS2008 because it does not support the dependencies folders. I don't have a VS2008 full...
Attachments
error.jpg
error.jpg (166.94 KiB) Viewed 5435 times
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Tue May 07, 2013 2:43 pm

Ok the VSexpress is fix now. I also checked new exe with it.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Tue May 07, 2013 3:08 pm

Something is goes wrong..in compile now ok, but when i run demo, i get an error.

Why this error? The previous version works ok (3.04).
Attachments
error2.jpg
error2.jpg (52.12 KiB) Viewed 5430 times
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Tue May 07, 2013 3:18 pm

was that assert in the sandbox demos, or in your project?

can you post the stack trace of the function that are called, so that I can see waht generate the bad number?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Tue May 07, 2013 3:36 pm

Yes,
here is some debug information for you.

That assert was in the sandbox demos, not in my project.

An error happens while loading a mesh "platformBridge.ngd"

After this call we get an assert.

Code: Select all
      // load a slide platform
      dMatrix slideMatrix(GetIdentityMatrix());
      slideMatrix.m_posit.m_x += 80.0f;
      slideMatrix.m_posit.m_z = -20.0f;
      //LoadSlide(scene, triggerManager, sceneCollision, "slide.ngd", slideMatrix, playGroundBody);
      LoadFerryBridge(scene, triggerManager, sceneCollision, "platformBridge.ngd", slideMatrix, playGroundBody);

      // load another hanging bridge
      dMatrix bridgeMatrix(GetIdentityMatrix());



here:
Attachments
error4.png
place and reason an error
error4.png (119.4 KiB) Viewed 5420 times
error3.png
debug info
error3.png (110 KiB) Viewed 5424 times
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Tue May 07, 2013 5:30 pm

that's extrange I do not get thsoe asserts. are you sure you have the latest code.
The only difference is that I am using VS proffesional and you are using express.
when I run in debug it run fine in my system in debug, release 32 and 64 bit.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Tue May 07, 2013 5:36 pm

I added an assert on n % n and it does no hit it in my system.
sync again see if it hit it on your system. I can not see what could be wrong there
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Tue May 07, 2013 5:54 pm

there is another thing that is different. I recently had to reset the SVN because I run out of space.
when you sync to SNV you soudl make a backup of your order copy and delete the forder and check out a new copy form SVN.
maybe there is a corrupted file.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests