Disable convex cast optimization

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Disable convex cast optimization

Postby pHySiQuE » Sat Aug 30, 2014 12:49 am

I use convex casting with my player controller to detect the ground, but Newton "optimizes" the results too aggressively; If I hit a slope that is not walkable, Newton returns this result and stops looking for results below that surface. This is causing some major problems because if my player runs into a steep slope, they fall into the ground.

I am aware of how Newton ray casts reduce the ray length each time a hit occurs. Normally this is good, but in this case I need to be able to detect all hits, as some of them are considered "invalid" and are to be ignored.

I'm poking around in the source, but am having trouble finding the place where a cylinder performs a convex cast against a collision tree shape. Can you point me in the right direction?
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Disable convex cast optimization

Postby Julio Jerez » Sat Aug 30, 2014 1:23 am

you control the hits in the call back.
if you want all hits all you need to do is return 1.0 in the call back it will continue finding more hits.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Disable convex cast optimization

Postby pHySiQuE » Sat Aug 30, 2014 11:25 am

Which callback? NewtonConvexCast only has a pre filter callback:
http://newtondynamics.com/wiki/index.ph ... ConvexCast

The problem I have is that some collisions are valid and some are invalid, within a single body, and I need to return them all so I can evaluate them.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Disable convex cast optimization

Postby Julio Jerez » Sat Aug 30, 2014 12:24 pm

what function are you using? there are tow family of functions, Raycast and collision

Code: Select all
   void NewtonWorldRayCast (const NewtonWorld* const newtonWorld, const dFloat* const p0, const dFloat* const p1, NewtonWorldRayFilterCallback filter, void* const userData, NewtonWorldRayPrefilterCallback prefilter, int threadIndex);
   void NewtonWorldConvexRayCast (const NewtonWorld* const newtonWorld, const NewtonCollision* const shape, const dFloat* const matrix, const dFloat* const p1, NewtonWorldRayFilterCallback filter, void* const userData, NewtonWorldRayPrefilterCallback prefilter, int threadIndex);

   int NewtonWorldCollide (const NewtonWorld* const newtonWorld, const dFloat* const matrix, const NewtonCollision* const shape, void* const userData, 
                              NewtonWorldRayPrefilterCallback prefilter, NewtonWorldConvexCastReturnInfo* const info, int maxContactsCount, int threadIndex);
   int NewtonWorldConvexCast (const NewtonWorld* const newtonWorld, const dFloat* const matrix, const dFloat* const target, const NewtonCollision* const shape, dFloat* const hitParam, void* const userData, 
                                NewtonWorldRayPrefilterCallback prefilter, NewtonWorldConvexCastReturnInfo* const info, int maxContactsCount, int threadIndex);


The ray cast take filter and prefilter that workl ar the featre granularity of the collsion, the contact calculation work at the object collision granularity they only take prefilter;
My guess is that you are using a NewtonWorldConvexCast function to do that job of a NewtonWorldConvexRayCast.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Disable convex cast optimization

Postby pHySiQuE » Sat Aug 30, 2014 12:31 pm

I am using NewtonWorldConvexCast(). Raycasts do not work for player collision because it's easy for them to miss small objects.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Disable convex cast optimization

Postby Julio Jerez » Sat Aug 30, 2014 1:17 pm

NewtonWorldConvexRayCast is a convex cast that works like using NewtonWorldConvexCast, but is does not calculate contacts, I use for the player controller.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Disable convex cast optimization

Postby pHySiQuE » Sat Aug 30, 2014 7:17 pm

Ha! I didn't know that existed. Thanks!
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Disable convex cast optimization

Postby pHySiQuE » Sat Aug 30, 2014 7:53 pm

The results of this command are really nice. I've finally got control of my player and I have resolved a lot of little problems.

The only issue I have now is that it seems like the convex raycast misses heightfields, until I am almost falling through it. It seems like the AABB overlap code might have a problem? I am using a rather older copy of the source code:
http://www.leadwerks.com/post/convexcast.avi
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Disable convex cast optimization

Postby Julio Jerez » Sat Aug 30, 2014 9:01 pm

I should work with all shaped.
you need to update to newton 3.13, there has being lot of bug fixed.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Disable convex cast optimization

Postby pHySiQuE » Sat Aug 30, 2014 9:05 pm

Is the SVN repository still working or do I have to use GIT?
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Disable convex cast optimization

Postby Julio Jerez » Sat Aug 30, 2014 9:46 pm

we moved to github.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Disable convex cast optimization

Postby pHySiQuE » Sat Aug 30, 2014 10:16 pm

Thank you.

I really believe in Newton, and I finally have the perfect application to show why it's the best:
https://www.kickstarter.com/projects/16 ... ion-neuron

I'm going to use these with the motorized joint feature to make physically interactive hands the player controls in virtual reality.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Disable convex cast optimization

Postby pHySiQuE » Sun Aug 31, 2014 2:01 pm

The latest source works great. I've got nice smooth collision on terrains. Thank you.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Disable convex cast optimization

Postby Julio Jerez » Sun Aug 31, 2014 3:43 pm

can you post the video again so that I can see the difference?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Disable convex cast optimization

Postby pHySiQuE » Sun Aug 31, 2014 11:30 pm

Actually, I found that the convex casting on terrain is still experiencing the same problem:


I move the cylinder up by the step height and cast downwards, the distance of the step height. It seems like no raycast is detected until the starting position intersects the height field, making the character controller bounce up and down. It looks like the AABB overlap test is not working right.

It works perfectly on everything but height fields.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest