[Solved]Player controller seems ignore tree collision.

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

[Solved]Player controller seems ignore tree collision.

Postby Neo » Sat May 18, 2013 6:25 am

This is a problem which I ignored before:
The new player controller(use playerControllerManager)performed well with convexhull and othet prime rigidbodies,
however, it seems that player controller may have some problems dealing with tree collision objects.

Prevously, I used a thin box,which also initialized as tree mesh collision body , to act as floor, and player controller stuck a half into the floor.(Sorry Julio, at that time I thought it
was coordinates problem and wasted you a lot of time discuss this with me)
Now, I replace the old thin-box floor with a plane mesh. As a result, player controller fall straight through the floor... :(
Is there anything wrong?
Last edited by Neo on Thu May 23, 2013 1:30 am, edited 1 time in total.
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Player controller seems ignore tree collision.

Postby Julio Jerez » Sat May 18, 2013 7:57 am

Maybe I do not know how to reproduce that bug. I just put back the mesh level I was using for demo "basic player controller"
and I do not see any problem. In fact the basic playerController demo has sevral meshes of different level of complexity, and I can vanigate on all of then withoy error
Code: Select all
//CreateLevelMesh (scene, "flatPlane.ngd", true);
//CreateLevelMesh (scene, "playground.ngd", true);
CreateLevelMesh (scene, "castle.ngd", true);
//CreateLevelMesh (scene, "sponza.ngd", true);
//CreateLevelMesh (scene, "sibenik.ngd", true);

The secund demo "AdvancePlayerController" is moving over a large flat polygon use as tree collision too, and I do not see that problem either.

can you sync and play demo BasicPlayerController. and see if you see the bug there.

you say that the mesh is a think box, can you tell me the side of the box, maybe I can place a mesh with the same dimensions and see if I can reproduce it.
of maybe you can tweak the demo an place a mesh that can reproduce the bug. now it play graciously with dynamics objects in the background

otherwise I do not know how to reproduce that.

I actually fixed lots of problems with the player controller did you get latest code?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Player controller seems ignore tree collision.

Postby Neo » Sat May 18, 2013 9:45 am

I currently use the code updated in March(by the time you have start making script system).
Since then I stopped updating engine, is the playerController have changed a lot since then?
BTW, I tried to update svn just now, but get an UUID error, what happend?
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Player controller seems ignore tree collision.

Postby Julio Jerez » Sat May 18, 2013 10:03 am

Oh yes the player was fixed this week. is has changed a lot.
I will upload a new stable download today,
I do not know what UUID is, is this windows.
where are you getting that?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Player controller seems ignore tree collision.

Postby JoeJ » Sat May 18, 2013 10:16 am

Maybe you need to delete tho old folder before updating.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Player controller seems ignore tree collision.

Postby Neo » Sat May 18, 2013 10:51 am

Julio Jerez wrote:I do not know what UUID is, is this windows.
where are you getting that?

Svn client report this error, every time when I try to update old folder.
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Player controller seems ignore tree collision.

Postby Julio Jerez » Sat May 18, 2013 10:54 am

Oh I see.
I run out of space on SVN and I had to reset the SVN repository to version one.
you backup or delete the folder were you download newton and check out a new version from SVN.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Player controller seems ignore tree collision.

Postby Neo » Sat May 18, 2013 12:03 pm

OK, I deleted the old folder and update newton in a new folder.
But there's some problem after updating:
What happened to raycast? It seems that the parameter of NewtonWorldRayFilterCallback has changed.
Also the parameter of createplayer has changed.

How can I modify the code accordingly?
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Player controller seems ignore tree collision.

Postby Julio Jerez » Sat May 18, 2013 12:56 pm

this is what ray cast filter is
void NewtonWorldRayCast (const NewtonWorld* const newtonWorld, const dFloat* const p0, const dFloat* const p1, NewtonWorldRayFilterCallback filter, void* const userData, NewtonWorldRayPrefilterCallback prefilter);

I do no remember changing it

the play now take a mass, as the first argument
CustomPlayerControllerManager::CustomController* CustomPlayerControllerManager::CreatePlayer (dFloat mass, dFloat outerRadius, dFloat innerRadius, dFloat height, dFloat stairStep, const dMatrix& localAxis)

that is what I have to do to make work with environment bodies.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Player controller seems ignore tree collision.

Postby Neo » Sat May 18, 2013 1:26 pm

Julio Jerez wrote:this is what ray cast filter is
void NewtonWorldRayCast (const NewtonWorld* const newtonWorld, const dFloat* const p0, const dFloat* const p1, NewtonWorldRayFilterCallback filter, void* const userData, NewtonWorldRayPrefilterCallback prefilter);

I do no remember changing it

Well, the function NewtonWorldRayCast does not change indeed. But the form of NewtonWorldRayFilterCallback has changed:
the previous version is:
typedef dFloat (*NewtonWorldRayFilterCallback)(const NewtonBody* body, const dFloat* hitNormal, int collisionID, void* userData, dFloat intersectParam);
but now in newton.h, it has become:
typedef dFloat (*NewtonWorldRayFilterCallback)(const NewtonBody* const body, const NewtonCollision* const shapeHit, const dFloat* const hitNormal, int* const collisionID, void* const userData, dFloat intersectParam);

you see, new parameter has added, so my original code would provide me a compile error...
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Player controller seems ignore tree collision.

Postby Julio Jerez » Sat May 18, 2013 2:08 pm

yes that is right.

typedef dFloat (*NewtonWorldRayFilterCallback)(const NewtonBody* const body, const NewtonCollision* const shapeHit, const dFloat* const hitNormal, int* const collisionID, void* const userData, dFloat intersectParam);

that was the old format of the filter, goes back to core 200 when the collision were reference counted
in core 300 the collision are instance, and in some cases (ex compound and scene collision collision) in a callbacks the collision shape you are processing is not the collision that is assigned to the body, it mat be a sub shape or a shape generate on the flight for modification popurse.
if you are not using that you can simply ignore const NewtonCollision* const shapeHit in your code.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Player controller seems ignore tree collision.

Postby Neo » Sun May 19, 2013 1:12 am

I see.
Now the game can comple and run again.
However , problem still exist. After several test, I finally fount that player controller seems to have problems dealling with
scaled tree collision: for simulate purpose, I scaled every collision to 1/10 of its original size, including tree collision, because my model size is too large
for simulation.
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Player controller seems ignore tree collision.

Postby Julio Jerez » Sun May 19, 2013 8:02 am

is that new or was that working before.

can you bake the scale on the collision tree shapes?

scaling collision tree make sense when you use many instance of the same shape with different size, Is that what you are doing?
if no you can simple apply the scale to the collision shape when you build the shape. since collision tree are polygon that make it easy.
it is temporary until I find out what the problem is.

can you tell me what king of meshes are you using as scaled collision tree so that I can reproduce similar test?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Player controller seems ignore tree collision.

Postby Neo » Sun May 19, 2013 12:03 pm

Not fully get your mean..
Basicaly, a huge pane mesh is loaded as floor, terrain,etc.
Then I called treeCollisionBeginBuild TreeCollisionAddFace and TreeCollisionEndBuild to build a terrain.
Because I'm a irrlicht user, so I have to fetch the vertices from IMeshSceneNode each time when I build this stuff.

After the build operation is over, I called the NewtonCollisionSetScale to scale the collision before make the rigid body.

And in my game other rigid body perform well with tree collision body, while player controller ignores it.
Neo
 
Posts: 127
Joined: Fri May 11, 2012 12:29 pm
Location: China,Sichuan

Re: Player controller seems ignore tree collision.

Postby Julio Jerez » Sun May 19, 2013 12:36 pm

Just to clarify, you have a big flat plane as floor, and you apply a scale od 1/10
the you put a player controller and it fail to collide with floor.

Is that right?

also can you post here the code that make the collision tree?
I believe I can provide a quick solution if what I mention above is the problem.

Also I fixe the problem that was making the player slow down when he hit corners with many small faces.
the controller is getting very good now.
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 1 guest