0
\$\begingroup\$

I can import scene from FBX file into my engine, and i want spheres, boxes and capsules to be imported as colliders. So, how i can check if imported instance is one of them? Thanks.

\$\endgroup\$
1
\$\begingroup\$

You could assign a specially named material to your colliders to identify them as such and use UV or color values to retrieve the orientation & scale.

The same special material trick is often used for navmesh.

For example:

  • a box collider could have its corners colored with RGB=XYZ with 0 or 1 depending on which end.
  • a capsule collider could have all its vertices to color 0,0,0 except two opposite vertices of the "caps" of the cylinder part, one end set to blue, one to red, average is center of end points, half distance is radius, length is given by both end centers.
  • for a sphere collider you can set two opposite vertices to a specific color, get the center from the average & radius from half the distance.

This way you can find the orientation and size of all colliders.

enter image description here

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.