[v2] Disable raycast for CollidableReference

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
AlexCereus
Posts: 7
Joined: Fri Feb 15, 2019 2:03 pm

[v2] Disable raycast for CollidableReference

Post by AlexCereus »

Hello.

Is it possible to ignore raycast for individual CollidableReference?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: [v2] Disable raycast for CollidableReference

Post by Norbo »

The specific API depends on what exactly is being tested- a specific Mesh versus the whole Simulation for example- but there is typically some callback provided to the query that lets you perform arbitrary filtering and result processing logic.

For example, the Simulation.RayCast takes a IRayHitHandler, which provides:

Code: Select all

        bool AllowTest(CollidableReference collidable);
        void OnRayHit(in RayData ray, ref float maximumT, float t, in Vector3 normal, CollidableReference collidable);
If AllowTest returns false for a given collidable, further testing (and OnRayHit) will not be executed.
Post Reply