Table of Contents

Method b3DynamicTree_RayCast

Namespace
Box3D.Native
Assembly
Box3D.NET.Native.dll

b3DynamicTree_RayCast(b3DynamicTree*, b3RayCastInput*, ulong, NativeBool, delegate* unmanaged[Cdecl]<b3RayCastInput*, int, ulong, void*, float>, void*)

Ray cast against the proxies in the tree. This relies on the callback to perform an exact ray cast in the case where the proxy contains a shape. The callback also performs any collision filtering. This has performance roughly equal to k * log(n), where k is the number of collisions and n is the number of proxies in the tree. Bit-wise filtering using mask bits can greatly improve performance in some scenarios. However, this filtering may be approximate, so the user should still apply filtering to results.

public static extern b3TreeStats b3DynamicTree_RayCast(b3DynamicTree* tree, b3RayCastInput* input, ulong maskBits, NativeBool requireAllBits, delegate* unmanaged[Cdecl]<b3RayCastInput*, int, ulong, void*, float> callback, void* context)

Parameters

tree b3DynamicTree*

the dynamic tree to ray cast

input b3RayCastInput*

the ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1)

maskBits ulong

bit mask test: bool accept = (maskBits & node->categoryBits) != 0;

requireAllBits NativeBool

modifies bit mask test: bool accept = (maskBits & node->categoryBits) == maskBits;

callback delegate* unmanaged[Cdecl]<b3RayCastInput*, int, ulong, void*, float>

a callback function that is called for each proxy that is hit by the ray

context void*

user context that is passed to the callback

Returns

b3TreeStats

performance data