using System;
using System.Numerics;
using System.Runtime.CompilerServices;
namespace MagicPhysX.Toolkit.Colliders
{
///
/// A sphere-shaped primitive collider.
///
public unsafe class SphereCollider : Collider
{
ref PxSphereGeometry GetGeometry() => ref Unsafe.AsRef(shape->GetGeometry());
internal SphereCollider(PxShape* shape, ColliderType type) : base(shape, type)
{
}
///
/// The center of the sphere 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;
}
}
}