Kinematic and dynamic body: interaction?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Kinematic and dynamic body: interaction?

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

Oh wow, isn't that amassing, the collision is so good that it get the playe on that corner.

That will be fix in my next check it because will change the cylinder wit two capsules, that way if it lands on that place again, it will slide out.
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 » Sun May 19, 2013 1:44 pm

Al right that bug is fixed now. I also fix the problem when the player controller was very slowing down the engine when hitting scrapping static meshes with many small faces.
now it doe more work because ether are more faces but is very reasonable.
I place the player on a typical mesh with places with significant small faces and the time spend is linear with the face it hit not the face it collects.

Place sync to SVN and try again. See if you find a new bug :mrgreen:
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 19, 2013 3:28 pm

A new form for a player looks nice and works better. He is no longer gets stuck in the bodies))

Now player is ready to use in game projects! I see that you made many changes in the code to implement the interaction with the bodies.

If I find another bug, i will post here)
--------
And about my game project. I have some problems with bodies.
I create the dynamic bodies and player. The dynamic bodies present in a game as a boxes. I get strange behavior of these bodies.
Boxes fall through the floor slightly and freeze standing on its corners. I can not understand what the problem is, probably where I'm doing something wrong initialization? Do you have any ideas why this happens?

Only one thing, I must check this with last version Newton, to see that problem is, I will try do this tomorrow, need to finish refactor of animation controller first. Then I will post a screenshot with problem.
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Sun May 19, 2013 4:00 pm

Enclave wrote:I have some problems with bodies.
I create the dynamic bodies and player. The dynamic bodies present in a game as a boxes. I get strange behavior of these bodies.
Boxes fall through the floor slightly and freeze standing on its corners. I can not understand what the problem is, probably where I'm doing something wrong initialization? Do you have any ideas why this happens?

I do not know was that working before?
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 19, 2013 5:58 pm

I dont know, this is a first time when I test this.
This is a code that create a boxes. (I set the position of bodies from another location)
There is a small bug with texture coordinates (they are not set correctly) but I think it does not matter now.

Code: Select all
   dVector size (64.0f, 64.0f, 64.0f, 0.0f);
   dMatrix shapeOffsetMatrix (GetIdentityMatrix());

   NewtonCollision* collision = NULL;

   collision = NewtonCreateBox (pGame->pPhysics->GetWorld(), size.m_x, size.m_y, size.m_z, 0, NULL);
   dMatrix matrix (shapeOffsetMatrix);
   matrix.m_front = matrix.m_front.Scale (1.0f / dSqrt (matrix.m_front % matrix.m_front));
   matrix.m_right = matrix.m_front * matrix.m_up;
   matrix.m_right = matrix.m_right.Scale (1.0f / dSqrt (matrix.m_right % matrix.m_right));
   matrix.m_up = matrix.m_right * matrix.m_front;
   NewtonCollisionSetMatrix(collision, &matrix[0][0]);

   // pointer to rigid body
   body = pGame->pPhysics->CreateSimpleSolid(&m_object, 16.0f, matrix, collision, 0);   
   NewtonDestroyCollision (collision);



At the same time, you can see that the boxes in the background is standing normal.
If the player will move the box, he can stand on the corner.

Here is a screenhot:
Attachments
Image2.jpg
Image2.jpg (80.77 KiB) Viewed 5376 times
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Sun May 19, 2013 6:23 pm

I do not know how or why that happened, there is a mode in sandBox Demos when you can load serialize worlds.

all you have to do is in you game you call
NewtonSerializeToFile (world, "filename.bin");


then you can go to the sandBox Demo and in the main menu you click New, and the Deserialize .
and you call load the exported Scene to the sand Box there you can check out what is wrong, and you can send it to me for debugging.

Please sync to syn again an try that.
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 » Mon May 20, 2013 3:50 am

Wow, it is a nice feature for debugging :D

I sync to last SVN, the same issues still present. But at first glance the form of collisions look good?

Here is a serialized scene from my game:

EDIT:
Julio, try to set these parameters for player. (in a BasicPlayerController.cpp)

Code: Select all
//#define PLAYER_WALK_SPEED            4.0f
#define PLAYER_WALK_SPEED            80.0f
#define PLAYER_THIRD_PERSON_VIEW_DIST   330.0f


Code: Select all
      // make the player controller, this function makes a kinematic body
      //m_controller = manager->CreatePlayer(80.0f, radius, radius * 0.5f, height, height * 0.33f, playerAxis);
m_controller = manager->CreatePlayer(60.0f, radius * 0.30f, radius * 0.15f, height, height * 0.33f, playerAxis);

      // players by default have the origin at the center of the lower bottom of the collision shape.
      // you can change this by calling SetPlayerOrigin, for example if a player has it origin at the center of the AABB you can call
m_controller->SetPlayerOrigin (height * 0.5f);


Code: Select all
   //BasicPlayerEntity* const player = new BasicPlayerEntity (scene, manager, 0.5f, 1.9f, location);
BasicPlayerEntity* const player = new BasicPlayerEntity (scene, manager, 44.243389f, 72.695694f, location);



They are the same as in my game. If you do this, you will get the same issues.

I'm not sure that these settings are correct, but if so, then maybe a bug somewhere.

1) Unexpected jump when the player moves another body.
2) No collisions with other kinematic bodies.
3) Sometimes a player goes through the pyramid (cone).
Attachments
filename.zip
(1.76 KiB) Downloaded 291 times
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Mon May 20, 2013 7:13 am

Oh I see what your problem is, you are setting the player walk speed to 80 because you is too big in units.
are your units do not appear to be centimeter or inches, what using are you using?

when I set the same parameter of 80 walk speed the player do walk fine in my demos,
the only difference is that is walk so fast that when it hit the big box, he has so much momentum that he kick out of the level

when I load the your level the demo doing this and setting the speed to 80, this is how it look like
worldTooBig.png
worldTooBig.png (185.63 KiB) Viewed 5358 times


at first the play fall through the ground but that's because the origin is off the world dimensions but after a change the spawn point fo the play to 63, 70, 126
them this sis what you see, In that level the play appears to move slow but in fact is really goes too fast.

you gravity must also be too huge, and that is what make the physic fail. It is losing floating point dynamics range precision everywhere

Newtons is calibrate to the metic system (meter, kilogram seconds), you need to scale you world
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 » Mon May 20, 2013 11:01 am

Strange, the size of body is 64*64*64 - this is to big? It is a size of boxes, and the height of my Player is 72, but I dont know which units, I can select any suitable, that will work good. I am using a metric system.

What means Player size 2.0 in the Sandbox demo? Which units?

you gravity must also be too huge, and that is what make the physic fail. It is losing floating point dynamics range precision everywhere


I set it to 9.8f, this is normal?

you need to scale you world


How I can do this? The standart texture size is 256*256, and for player I plan use up to 512*512 or more, it depends from quality the end model.
Is it possible to scale texture 256*256 to 2*2 size?? (which Newton Demo Player has). Please explain, how to do this.

----------

Julio, there is one bug, the screen is flashing and some triangles on demo physic objects becomes black. This happens after last update from SVN, (from ~159-162) this issue was also before, but then disapears (after migrate to wxWidgets). But now I again get this. It only happens on the built-in graphics cards, like Intel 945 chipset. I test is on my laptop (Intel HD Graphics
) and on work computer. Revision 168 on my laptop works ok without flashing, but I am not sure it will work on work PC, I have to make test tomorrow.
Last edited by Enclave on Mon May 20, 2013 12:40 pm, edited 1 time in total.
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Mon May 20, 2013 12:38 pm

a box of size 64 is 64 meters, a play 72 is 72 meters tall than really too big, a person is about 1.8 to 2.0 meters tall.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby JoeJ » Mon May 20, 2013 12:42 pm

If you use 9.8f gravity, you need to treat the values as meters (1.0f = 1 meter), so your character is actually 72 meters high - a real big guy :)
If you want it 2 meters high, you need to scale all coordinates of your world by a factor of (2.0 / 72.0), before you pass them to newton.
Then you have the recommended units. I don't understand what you mean with texture size.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Mon May 20, 2013 1:13 pm

If you use 9.8f gravity, you need to treat the values as meters (1.0f = 1 meter), so your character is actually 72 meters high - a real big guy


Wow! Yes, I need to scale him.

I don't understand what you mean with texture size


Look to \newton-dynamics\applications\media, the file wood_0.tga has a size (resolution) 256*256 pixels. My modeling program makes a bodies, for example, 64*64*64 units size. It cannot make a mesh, with a size 2*2*2 unit, because a minimum unit is 1.
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Mon May 20, 2013 2:05 pm

what modeling program are you using?
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 21, 2013 1:34 am

I have a lot of programs, but the simplest is the 3D World Studio. I am using it for creating simple objects.

Now about the graphical glitches.

Look to the screenshots, it shows how sandbox looks when running on integrated graphics, Intel 946GZ chipset.
Attachments
error2.jpg
error2.jpg (64.62 KiB) Viewed 5336 times
error1.jpg
error1.jpg (158.98 KiB) Viewed 5336 times
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Tue May 21, 2013 2:11 pm

These graphical glitches began with revision 159, before that everything was fine. What you changed in the code?
It is impossible to use the sandbox with these glitches... :(
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest