using System.Numerics; using System.Runtime.CompilerServices; namespace MagicPhysX.Toolkit.Colliders { /// /// A capsule-shaped primitive collider. /// public unsafe class CapsuleCollider : Collider { ref PxCapsuleGeometry GetGeometry() => ref Unsafe.AsRef(shape->GetGeometry()); internal CapsuleCollider(PxShape* shape, ColliderType type) : base(shape, type) { } /// /// The center of the capsule, measured in the object's local space. /// public Vector3 center { get => shape->GetLocalPose().p; set { var pose = shape->GetLocalPose(); pose.p = value; shape->SetLocalPoseMut(&pose); } } /// /// The radius of the sphere, measured in the object's local space. /// public float radius { get => GetGeometry().radius; set => GetGeometry().radius = value; } /// /// The height of the capsule measured in the object's local space. /// public float height { get => GetGeometry().halfHeight * 2f; set => GetGeometry().halfHeight = value / 2f; } ///// ///// The direction of the capsule. ///// //public int direction //{ // // TODO: // get => throw new NotImplementedException(); // // TODO: // set => throw new NotImplementedException(); //} } }