I have a particular collider I’ve been trying to raycast against. I’m getting zero results so far, nothing happens no matter what I do. My goal is to know if my mouse pointer is inside the collider. Trying to cast a ray from the mouse position to the center of the collider. Why doesn’t this work?
intersectPlane.Raycast(screenPointToRay, out var mouseHit);
mouseWorldPos = screenPointToRay.GetPoint(mouseHit);
Entities.WithoutBurst().ForEach(
((in PhysicsCollider collider, in BoxGrid grid, in Rotation rotation, in Translation translation)) =>
{
if (!collider.Value.Value.CastRay(ray, out var hit))
{
//snap mouse to grid
Draw.WireBox(p,rotation.Value ,1);
}
}).Run();
CastRay always returns false. Entity has a PhysicsCollider and a PhysicsBody. I don’t think it needs a physics body to be able to detect ray collisions, but I did try it with and with out one. The objects are also in a Sub Scene. Thanks in advance.