Class EntityExtensions
Provides extension methods for the Entity class to simplify adding Bullet 2D and 3D physics components.
public static class EntityExtensions
- Inheritance
-
EntityExtensions
Methods
AddBullet2DPhysics(Entity, Primitive2DModelType, Bullet2DPhysicsOptions?)
Adds Bullet 2D physics components to the entity with an appropriate collider shape based on the primitive type.
public static Entity AddBullet2DPhysics(this Entity entity, Primitive2DModelType type, Bullet2DPhysicsOptions? options = null)
Parameters
entityEntityThe entity to add physics components to.
typePrimitive2DModelTypeThe type of 2D primitive shape for the collider.
optionsBullet2DPhysicsOptionsOptional physics configuration including the physics component, size, depth, and whether to include a collider. If null, default options are used.
Returns
- Entity
The entity with the Bullet 2D physics components added.
Exceptions
- ArgumentNullException
Thrown when
entityis null.- InvalidOperationException
Thrown when an unsupported Primitive2DModelType is specified.
AddBullet3DPhysics(Entity, PrimitiveModelType, Bullet3DPhysicsOptions?)
Adds Bullet 3D physics components to the entity with an appropriate collider shape based on the primitive type.
public static Entity AddBullet3DPhysics(this Entity entity, PrimitiveModelType type, Bullet3DPhysicsOptions? options = null)
Parameters
entityEntityThe entity to add physics components to.
typePrimitiveModelTypeThe type of 3D primitive shape for the collider.
optionsBullet3DPhysicsOptionsOptional physics configuration including the physics component, size, and whether to include a collider. If null, default options are used.
Returns
- Entity
The entity with the Bullet 3D physics components added.
Remarks
Some primitive types (Torus, Teapot) do not have a collider shape and will be added without a collider even if IncludeCollider is true.
Exceptions
- ArgumentNullException
Thrown when
entityis null.