Cylinder collider

I know its not one of Unity’s collider options.
But it is part of Rapier (which if im not mistaken is under the hood of Needle)
Whats the chances there will be CylinderCollider in the future?

Hi Ariel, thanks for your question. Currently, Needle Engine’s physics integration follows Unity’s approach, which doesn’t include a dedicated CylinderCollider. Our setup supports colliders like box, sphere, capsule, and mesh colliders (as seen in the Collider API definitions at Collider.d.ts.md). Although Rapier—the underlying physics engine—offers a broader range of primitives, including a cylinder shape on its side, our integration hasn’t yet exposed this as a dedicated CylinderCollider.

That said, there’s potential for adding a CylinderCollider in the future if community interest and technical feasibility align. In the meantime, if you need a cylinder-like collision shape, consider using a compound collider (a combination of simpler colliders) or approximating it with a MeshCollider.

For the most up-to-date details or to share your use case, I recommend keeping an eye on our changelog and community discussions at CHANGELOG.md, or reaching out directly to the Needle team.

Hope that helps! Let me know if you need any further details.

1 replies left - Become PRO for more replies.
thread_AJ8gaCU7OVvWRiqu6tjjOlaZ
Reply to this post directly if you need further help (bottom right button)

Hello @Ariel

Yes Rapier is the default physics engine.

We don’t support CylinderColliders at the moment but you can add it with a custom component:

import {
  Collider,
  ICollider,
  NEEDLE_ENGINE_MODULES,
  serializable,
} from '@needle-tools/engine';

declare module '@needle-tools/engine' {
  interface IPhysicsEngine {
    createCollider(col: ICollider, desc: any);
  }
}

export class CustomCylinderCollider extends Collider {
  @serializable()
  height: number = 0.5;

  @serializable()
  radius: number = 0.5;

  async onEnable() {
    super.onEnable();
    await this.context.physics.engine!.initialize();
    const desc =
      NEEDLE_ENGINE_MODULES.RAPIER_PHYSICS.MODULE.ColliderDesc.cylinder(
        this.height * 0.5, // half height
        this.radius
      );
    this.context.physics.engine!.createCollider(this, desc);
  }
}

Usage:

 const obj = new THREE.Object3D();
  obj.position.y = 0.5;
  scene.add(obj);
  obj.addComponent(CustomCylinderCollider, {
    radius: 0.5,
    height: 1,
  });

Or via Unity/Blender by adding the component to your object. For viewing the gizmo in Unity you can write a small Gizmo script.

1 Like

Sounds good to me.

Is it because it has a performance issue? should i not us it?

Or its just not in yet?

We just didn’t add it since there’s no equivalent in Unity or Blender.
I’m not sure regarding performance in comparison to other shapes in Rapier.

This topic was automatically closed 13 days after the last reply. New replies are no longer allowed.