Raycast in reverse

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
imtrobin
Posts: 101
Joined: Thu Jun 11, 2009 3:03 am

Raycast in reverse

Post by imtrobin »

I have a statictrianglegroup, I'm using it as a terrain and I'm doing raycast to get terrain height. So, I'm doing it from downwards

triangleStaticGroup.RayCast (new Vector3 (1000, -1, 1000), Vector.UnitY, 10000.0f ..)

instead of the usual top down.

triangleStaticGroup.RayCast (new Vector3 (1000, 10000, 1000), -Vector.UnitY, 10000.0f ..)

I find that it works on the edges (0,-1,0), but within the map, it returns 0. Would this be a bug?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Raycast in reverse

Post by Norbo »

There's definitely a bug somewhere. I'll look into it.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Raycast in reverse

Post by Norbo »

On second glance, it turns out my test was accidentally using the X coordinate of the camera for both the X and Z coordinate of the raycast, explaining the problem I observed :). I haven't found a bug yet.

If your triangle mesh ever drops below -1 on the y coordinate, that particular raycast will fail, but I assume that you have created the terrain so that it is always above that point.
imtrobin
Posts: 101
Joined: Thu Jun 11, 2009 3:03 am

Re: Raycast in reverse

Post by imtrobin »

Yes, my terrain is above 0
imtrobin
Posts: 101
Joined: Thu Jun 11, 2009 3:03 am

Re: Raycast in reverse

Post by imtrobin »

I think it's my collision proxy, it has a additional plane at Y = 0 that got exported. Sorry for the false alarm.
Post Reply