[v2] Disable raycast for CollidableReference

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

[v2] Disable raycast for CollidableReference

Post by AlexCereus » Wed Mar 06, 2019 12:00 pm

Hello.

Is it possible to ignore raycast for individual CollidableReference?

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

Re: [v2] Disable raycast for CollidableReference

Post by Norbo » Wed Mar 06, 2019 7:25 pm

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

Who is online

Users browsing this forum: No registered users and 1 guest