Problem with the playerController

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Problem with the playerController

Postby Enclave » Tue May 28, 2013 1:03 pm

Is the some graphical artefacts on video, caused by high compression, but I hope that we can see major details.

that will prevent the player form hitting any obstacle, try that and let me know if it fixes that.


I have tried this, is no good effect. Is only effect that I cannot move any body anymore, and thats all. The player still jumping.

I also see a lot of stuff very wrong on that video. why those boxes stay on one edge when the player hit them, there most be something else that is wrong.


Yes, this is a my question for you. :D . Why is that?

Here is a serialized scene:

The player speed is 8.0f, weight is 90.0f, the box weight is 10.0f.

EDIT: I am change level floor plane to small. The same issues is also present.
Attachments
filename.zip
(1.64 KiB) Downloaded 170 times
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Problem with the playerController

Postby Julio Jerez » Tue May 28, 2013 2:30 pm

Ok let us do this, wait until I add teh dll linking to teh jopint library, so that you send me and executable, because waht I see is no right.
There are more than just the player malfuntion there. Those boxes in te hsnce sodul behave normal and tehy are not.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

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

Ok let us do this, wait until I add teh dll linking to teh jopint library, so that you send me and executable, because waht I see is no right.
There are more than just the player malfuntion there. Those boxes in te hsnce sodul behave normal and tehy are not.


I will correct you a little bit, ALL the boxes do not behave properly. You can see on video, sometimes they are ok, but sometimes are not.

The only one thing is strange, if you load the included serialized scene into Sandbox, everything looks fine.
Maybe I do some initialisation of Newton engine wrong ? But on first look I do the same, as in demos. I dont know, how it is possible, that in my engine it is not work, but the same scene works good in the Sandbox.

I will wait until you finish DLL fix.
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Problem with the playerController

Postby JoeJ » Tue May 28, 2013 3:26 pm

After looking video i thaught maybe inertia is not calculated correctly with scaled geometry.
This is not the case, but i can confirm that scaled boxes indeed behave wrong, while unscaled boxes are fine.
Using test setup as below the third scaled box tumbles around strangly, but it has equal mass properties as box 2.


Code: Select all
if (1) // scale test
   {
      float mass[3], Ixx[3], Iyy[3], Izz[3];
      sMat4 m;

      Shape *s1 = CreateBoxShape (sVec3(10,10,10));
      m.Identity(); *m.Translation() = sVec3 (-10, 5, 0);
      Body *b1 = CreateRigidBody (1, m, s1);
      ReleaseShape (s1);
      BodyGetMassMatrix (b1, mass[0],  Ixx[0], Iyy[0], Izz[0]);

      Shape *s2 = CreateBoxShape (sVec3(1,1,1));
      m.Identity(); *m.Translation() = sVec3 (-20, 5, 0);
      Body *b2 = CreateRigidBody (1, m, s2);
      ReleaseShape (s2);
      BodyGetMassMatrix (b2, mass[1],  Ixx[1], Iyy[1], Izz[1]);

      Shape *s3 = CreateBoxShape (sVec3(10,10,10));
      NewtonCollisionSetScale (s3, 0.1, 0.1, 0.1);
      m.Identity();
      *m.Translation() = sVec3 (-30, 5, 0);
      Body *b3 = CreateRigidBody (1, m, s3);
      ReleaseShape (s3);
      BodyGetMassMatrix (b3, mass[2],  Ixx[2], Iyy[2], Izz[2]);

      int stop = 1;


   }
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Problem with the playerController

Postby JoeJ » Tue May 28, 2013 3:48 pm

I recreated that in the sandbox, and surprise... it works there :)
Is there something wrong with my scaling:
1. Create collision
2. scale by NewtonCollisionSetScale ();
3. create body
Is ther something more that needs to be done?


modified box stacks demo, NOT reproducing the bug, just for reference:

Code: Select all
#include <toolbox_stdafx.h>
#include "SkyBox.h"
#include "../DemoEntityManager.h"
#include "../DemoCamera.h"
#include "DemoMesh.h"
#include "PhysicsUtils.h"

#include "CustomBallAndSocket.h"
#include "CustomKinematicController.h"


static NewtonBody* BuildBox (DemoEntityManager* const scene, dFloat mass, const dVector& origin, const dVector& size, const dVector* scale = 0)
{
   dMatrix matrix (GetIdentityMatrix());

   // create the shape and visual mesh as a common data to be re used
   NewtonWorld* const world = scene->GetNewton();
   NewtonCollision* const collision = CreateConvexCollision (world, GetIdentityMatrix(), size, _BOX_PRIMITIVE, 0);
   if (scale) NewtonCollisionSetScale (collision, scale->m_x, scale->m_y, scale->m_z);


   DemoMesh* const geometry = mass
      ? new DemoMesh("DynBox", collision, "smilli.tga", "smilli.tga", "smilli.tga")
      : new DemoMesh("StaticBox", collision, "wood_0.tga", "wood_0.tga", "wood_1.tga");

   matrix.m_posit = origin;

   NewtonBody *body = CreateSimpleSolid (scene, geometry, mass, matrix, collision, 0);

   // do not forget to release the assets   
   geometry->Release();
   NewtonDestroyCollision (collision);

   return body;
}




void BasicBoxStacks (DemoEntityManager* const scene)
{

   BuildBox (scene, 0.0f, dVector(0,-5,0), dVector (100, 10, 100)); // ground
   
   BuildBox (scene, 1.0f, dVector(0,10,-10), dVector (10, 10, 10));
   BuildBox (scene, 1.0f, dVector(0,10, 10), dVector (1, 1, 1));
   BuildBox (scene, 1.0f, dVector(0,10,0), dVector (10, 10, 10),  &dVector (0.1, 0.1, 0.1));
   



   // place camera into position
   dQuaternion rot;
   dVector origin (-20.0f, 2.0f, 0.0f, 0.0f);
   scene->SetCameraMatrix(rot, origin);


   //   ExportScene (scene->GetNewton(), "../../../media/test1.ngd");
}


EDIT: I've compared full body creation between sandbox and my app, but i have not found any difference that matters.
Last edited by JoeJ on Tue May 28, 2013 4:19 pm, edited 1 time in total.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Problem with the playerController

Postby Enclave » Tue May 28, 2013 4:11 pm

JoeJ

Try to Serialize your scene to binary file, then deserialize it in Sandbox, then switch on option "show wireframe collision mesh".
I am get some issues with bodies, scaled with newton function "NewtonCollisionSetScale", so I am not use it. Maybe you will see some strange things in wireframe mode. Scaled boxes looks like unscaled, but collision is a scaled.

I think this function is not working properly.
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Problem with the playerController

Postby JoeJ » Tue May 28, 2013 4:40 pm

I can not load serialized file in sandbox, click File / Load but nothing happens (last update when cloth demo was added).

However, maybe it's useful for Julio because scene is very simple - 2 nice and one mad boxes.
Attachments
slz.zip
(489 Bytes) Downloaded 167 times
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Problem with the playerController

Postby Enclave » Tue May 28, 2013 4:55 pm

JoeJ

Try to select "File/Deserialize".

EDIT: I tried this, then Sandbox is crashed. :o
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Problem with the playerController

Postby Julio Jerez » Tue May 28, 2013 5:11 pm

Joe you say that this tesr reprodued the bug
Code: Select all
if (1) // scale test
   {
      float mass[3], Ixx[3], Iyy[3], Izz[3];
      sMat4 m;

      Shape *s1 = CreateBoxShape (sVec3(10,10,10));
      m.Identity(); *m.Translation() = sVec3 (-10, 5, 0);
      Body *b1 = CreateRigidBody (1, m, s1);
      ReleaseShape (s1);
      BodyGetMassMatrix (b1, mass[0],  Ixx[0], Iyy[0], Izz[0]);

      Shape *s2 = CreateBoxShape (sVec3(1,1,1));
      m.Identity(); *m.Translation() = sVec3 (-20, 5, 0);
      Body *b2 = CreateRigidBody (1, m, s2);
      ReleaseShape (s2);
      BodyGetMassMatrix (b2, mass[1],  Ixx[1], Iyy[1], Izz[1]);

      Shape *s3 = CreateBoxShape (sVec3(10,10,10));
      NewtonCollisionSetScale (s3, 0.1, 0.1, 0.1);
      m.Identity();
      *m.Translation() = sVec3 (-30, 5, 0);
      Body *b3 = CreateRigidBody (1, m, s3);
      ReleaseShape (s3);
      BodyGetMassMatrix (b3, mass[2],  Ixx[2], Iyy[2], Izz[2]);

      int stop = 1;
   }



Enclave the DLL thonk is no sometho you do in an afternoon.
I have to make teh dMath, dContainer, libreioes to have dll export.
and the borble I have ineh pass was that I could not get dll imprt export to work corrently on templates
I will try again tonoght,

The way to do it is by hiding all the data and exposing only funtions form all eh classes and hev ethe to only have abstarct inteface function.
I do not like this method too much because is forces you to have tow copies of each class.
and subclassing become some what more complex fo rthe clien app.

but that saves the step of making all other support libraries alos DLL.
I think will do that was. this way is also more friendly to oteh laguges that do no support c++ libk to librarires.
I do not wnat to hav eth dMath class as a dll because it si no part of the engine
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

Postby Julio Jerez » Tue May 28, 2013 5:17 pm

Joe seriaalization is no backwaor compatible. you will have to get the latest build.
I added a new shape, and some of the collsion types are differents,

cna you sync to svn and serialize the scene again?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

Postby Enclave » Tue May 28, 2013 5:44 pm

Julio,
In this forum I read that it can be compiled in a DLL. If this is not possible, then I will use it as before, as a static library. So do not worry about it.
Last edited by Enclave on Tue May 28, 2013 5:45 pm, edited 1 time in total.
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Problem with the playerController

Postby JoeJ » Tue May 28, 2013 5:45 pm

Enclave wrote:Try to select "File/Deserialize".
EDIT: I tried this, then Sandbox is crashed.

Ah yes, did the update and serialize commands are there now.
I guess crash comes from version mismatch.
I'll see if i can upload new file, but i have compilation issues to solve first...

Joe you say that this tesr reprodued the bug

Yes - in my app, but i did the same in sandbox and here it works.
Taking Code from sandbox back in my app is buggy again, found no difference in our body creation stuff... strange.

cna you sync to svn and serialize the scene again?

Newton does not compile in my own project anymore.
Preproc. def. still valid?
PTW32_STATIC_LIB
DG_USE_NORMAL_PRIORITY_THREAD
_NEWTON_USE_LIB
_NEWTON_STATIC_LIB
Ill see if the errors come from a file you have added, but is not in my project yet...

Edit: nope, added all files but still errors like:

1>c:\dev\newton-dynamics-read-only\corelibrary_300\source\physics\dgworlddynamicssimplesolversimd.cpp(32): error C2039: 'CalculateIslandReactionForcesSimd' : is not a member of 'dgWorldDynamicUpdate'

or

error C3861: 'zero': identifier not found c:\dev\newton-dynamics-read-only\corelibrary_300\source\physics\dgworlddynamicsparallelsolversimd.cpp
because dgSimd is unknown at that point
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Problem with the playerController

Postby Julio Jerez » Tue May 28, 2013 6:21 pm

this file dgworlddynamicsparallelsolversimd.cpp alone with all o fteh sse code is no longer part of te hengine.
But that was several versions ago.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with the playerController

Postby JoeJ » Wed May 29, 2013 1:53 am

Oops, ok...

I'm at work now and can't do anything, but i was thinking more about my initial inertia guess.
In the youtube video with a upscaled world the bodies look like tehy are so hard to turn, that angular damping is stronger than gravity, so they keep on the edge.
In my test i did a downscale and the body is so easy to turn that it does not come to rest.
Maybe inertia is scaled twice by accident in some situation, but i need to repeat my test later with updated newton...
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Problem with the playerController

Postby JoeJ » Wed May 29, 2013 3:24 am

I recompiled my project here with clean upadted newton, nothing changed.
I'd like to compare inertia values with my working sandbox demo, but there's a problem with vs2012 project:
2012 Express.PNG
2012 Express.PNG (39.68 KiB) Viewed 3687 times
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest