Compound Collider Questions

I am trying to implement a runtime 3D cursor (think transform gizmo). My idea is to create a single Entity with a 3DCursor ICD tag with a compound physics collider where boxes represent the three axis.

  • When resolving a raycast, can I determine which of the primitives that comprise the compound collider was hit so I can determine which axis is being dragged?
  • Looking at the compound collider example, why are lines 55 and 56 necessary? I assume line 58 or 59 would apply the same logic.
  1. You get a collider key in the RaycastHit structure, you can use that to get the child from the compound collider which was hit. CompoundCollider.GetChild(ColliderKey, out child) is the thing you need to call.
  2. Those 2 lines are there for our own collection of the stuff we created, to be able to dispose them later in the base class. Nothing to worry about in your code.
1 Like