Raycast bug?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Danthekilla
Posts: 136
Joined: Sun Jan 17, 2010 11:35 am

Raycast bug?

Post by Danthekilla »

Hey norbo i have been doing things as per normal and when adding a hammer to our game i have encountered something very odd that i have never encounted before...

Which is that raycasting this object (a compound body with 2 bodys) fails when the object is rotated...

What is odd about this is that we have only one simulator and its debug says everything is rotating correctly but it isn't...

If i rotate the hammer i cannot select the object correctly... with the raycasting.
The only thing to note is the physics is running at a very small timestep at all times during edit mode but i have never seen any selection be off by even the smallest bit before and this is off by heaps.

For selection we raycast the same simulator that is having its debug shown...

Here is a video.
http://www.youtube.com/watch?v=LbbVmgL8hJo

Thanks for your help.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Raycast bug?

Post by Norbo »

It appears that the acceleration structure is not being updated. When you mouse over certain areas, it still works since the 'old' bounding boxes overlap those areas and the raycast finds hits.

The acceleration structure updates every time the Compound updates (it won't update if it's deactivated) and when the orientation is manually changed. I'm not sure how the hammer got into that state, but one successful update should get it out of it.
Danthekilla
Posts: 136
Joined: Sun Jan 17, 2010 11:35 am

Re: Raycast bug?

Post by Danthekilla »

That explains everything, we have a little bug in our editor where some things fall asleep at the moment, anyway to manually update the objects bounds?

Thanks
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Raycast bug?

Post by Norbo »

If the editor is still updating, you might be able to just set the compound's IsActive to true and the next frame would take care of it. Trying to change the orientation will force it too; you could set the InternalOrientationQuaternion to its current InternalOrientationQuaternion.

There's probably a way to change how its initialized to avoid the problem altogether, though that might take more work.
Post Reply