hitParam in NewtonWorldRayCast

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

hitParam in NewtonWorldRayCast

Postby SFCBias » Fri Oct 28, 2011 9:02 pm

I've recently started playing with NewtonWorldRayCast, and I've searched as thouroughly as i could but i can't find what exactly 'hitParam' is. In the tutorial code for FindFloor i see it's set to 1.2f. How does this effect the raycast and in Convex collision, it returns 1.2 at some points. I figure 1.2f is significant number, but I can't make sense of it.
SFCBias
 
Posts: 54
Joined: Tue Jun 22, 2010 12:40 am
Location: Hephzibah,GA

Re: hitParam in NewtonWorldRayCast

Postby Julio Jerez » Sat Oct 29, 2011 9:22 am

1.2 is not significan it is just a numbe I like, it just have to be a value large that 1.0

basically each time a ray touch an object is check i fteh mparame is smaller tha teh current param, if it is then the new hit must be closer,

but doing that you can asccelerate the ray scan.
if you return the parma value that the scanner will no continue schcking for objevt benhing the teh current mParam, this will return the closest hit and is teh fastest
if you return 1.x then it will scane all object alone pass. and you will get out of order, but can palce then in an ordered list but and insertion sort by they T value.

you can also get first hit, this is returning 0.0 in the call back and the scanner will bail out, and you get a hit, not nessesally the closest.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: hitParam in NewtonWorldRayCast

Postby SFCBias » Sat Oct 29, 2011 10:21 am

Thank you for your reply. Now i'm not sure what the value represents. Or what i can do with it after the raycast.
SFCBias
 
Posts: 54
Joined: Tue Jun 22, 2010 12:40 am
Location: Hephzibah,GA

Re: hitParam in NewtonWorldRayCast

Postby Julio Jerez » Sat Oct 29, 2011 11:08 am

if you shot a ray cast form point p0 to p1

the hit point is given by

p = p0.Scale (param) + p1.Scale (1 - param)
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron