Problem with Raycast

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Problem with Raycast

Postby mikeman42 » Mon Jun 13, 2011 6:50 am

I'm using raycast to "snap" the camera to a terrain(TreeCollision). And while the result is generally correct, I constantly get a small jittering movement up-down when I move the camera, the motion is not smooth. Why is that happening, is the precision of the raycast somewhat less than it ought to be? This is the code:


Vec3 ray=Vec3(0,-1000,0);
Vec3 pos=Vec3(position.x,500,position.z);
RaycastResult res=Raycast(gWorld->GetNewtonWorld(),pos,pos+ray);
position=pos+ray*res.t+Vec3(0,0.3,0);

(Raycast is my own function that uses NewtonWorldRaycast and returns a RaycastResult with "t" being the intersection param).
mikeman42
 
Posts: 19
Joined: Tue May 01, 2007 6:08 pm

Re: Problem with Raycast

Postby Julio Jerez » Mon Jun 13, 2011 7:03 am

Ray cast is exact on all promitives
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Problem with Raycast

Postby mikeman42 » Mon Jun 13, 2011 7:21 am

Ok, problem solved, it wasn't due to raycast, I had another error somewhere else. Strange, I was working on it for several hours but I only solved it when you affirmed that raycast works fine :)

Thanks!
mikeman42
 
Posts: 19
Joined: Tue May 01, 2007 6:08 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron