Class BulletPhysicBody3D
The BulletPhysicBody3D implements Bullet physic object for Evergine.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Bullet
Assembly: Evergine.Bullet.dll
Syntax
public abstract class BulletPhysicBody3D : DisposableObject, IPhysicBody3D
Constructors
BulletPhysicBody3D(BulletPhysicManager3D, PhysicBodyDef3D)
Initializes a new instance of the BulletPhysicBody3D class.
Declaration
public BulletPhysicBody3D(BulletPhysicManager3D simulation3D, PhysicBodyDef3D bodyDef)
Parameters
Type | Name | Description |
---|---|---|
BulletPhysicManager3D | simulation3D | The bullet world. |
PhysicBodyDef3D | bodyDef | The definition of static body. |
Fields
EmptyCollider
The empty shape.
Declaration
protected static BulletEmptyCollider3D EmptyCollider
Field Value
Type | Description |
---|---|
BulletEmptyCollider3D |
bodyComponent
The user data.
Declaration
protected PhysicBody3D bodyComponent
Field Value
Type | Description |
---|---|
PhysicBody3D |
bodyDef
Rigid body definition.
Declaration
protected PhysicBodyDef3D bodyDef
Field Value
Type | Description |
---|---|
PhysicBodyDef3D |
collider
The single collider.
Declaration
protected BulletCollider3D collider
Field Value
Type | Description |
---|---|
BulletCollider3D |
colliders
Colliders set.
Declaration
protected HashSet<BulletCollider3D> colliders
Field Value
Type | Description |
---|---|
HashSet<BulletCollider3D> |
collisionCategories
The collision flags.
Declaration
protected CollisionCategory3D collisionCategories
Field Value
Type | Description |
---|---|
CollisionCategory3D |
hasOffset
This body has an offset applied.
Declaration
protected bool hasOffset
Field Value
Type | Description |
---|---|
bool |
maskBits
The mask bits.
Declaration
protected CollisionCategory3D maskBits
Field Value
Type | Description |
---|---|
CollisionCategory3D |
offsetScale
The offset scale.
Declaration
protected Vector3 offsetScale
Field Value
Type | Description |
---|---|
Vector3 |
Properties
AnisotropicFriction
Gets or sets the anisotropic friction.
Declaration
public Vector3 AnisotropicFriction { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
BodyComponent
Gets or sets physic body component. This is usually the component that has created this physic body.
Declaration
public PhysicBody3D BodyComponent { get; set; }
Property Value
Type | Description |
---|---|
PhysicBody3D |
CcdMotionThreshold
Gets or sets the CCD motion threshold.
Declaration
public float CcdMotionThreshold { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
CCD motion clamping activates for convex objects that exceed a (squared to avoid taking square roots) velocity threshold. By default this threshold is zero, which means this feature is disabled for rigid bodies.
CcdSweptSphereRadius
Gets or sets the CCD swept shere radius.
Declaration
public float CcdSweptSphereRadius { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
CCD works on an embedded sphere of radius, make sure this radius is embedded inside the convex objects, preferably smaller.
Collider
Gets or sets the associated collider.
Declaration
protected BulletCollider3D Collider { get; set; }
Property Value
Type | Description |
---|---|
BulletCollider3D |
ColliderShapes
Gets the colliders enumerable.
Declaration
public IEnumerable<IColliderShape3D> ColliderShapes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IColliderShape3D> |
CollisionCategories
Gets or sets the collision category bits.
Declaration
public CollisionCategory3D CollisionCategories { get; set; }
Property Value
Type | Description |
---|---|
CollisionCategory3D |
CompanionId
Gets or sets the Companion ID.
Declaration
public int CompanionId { get; set; }
Property Value
Type | Description |
---|---|
int |
CompoundCollider
Gets or sets the compound collider.
Declaration
protected BulletCompoundCollider3D CompoundCollider { get; set; }
Property Value
Type | Description |
---|---|
BulletCompoundCollider3D |
ContactDamping
Gets the contact damping.
Declaration
public float ContactDamping { get; }
Property Value
Type | Description |
---|---|
float |
ContactProcessingThreshold
Gets or sets the contact processing threshold.
Declaration
public float ContactProcessingThreshold { get; set; }
Property Value
Type | Description |
---|---|
float |
ContactStiffness
Gets the contact stiffness.
Declaration
public float ContactStiffness { get; }
Property Value
Type | Description |
---|---|
float |
DeactivationTime
Gets or sets the deactivation time.
Declaration
public float DeactivationTime { get; set; }
Property Value
Type | Description |
---|---|
float |
Flags
Gets or sets the rigid body flags.
Declaration
public StaticBody3DFlags Flags { get; set; }
Property Value
Type | Description |
---|---|
StaticBody3DFlags |
Friction
Gets or sets the friction of the rigid body.
Declaration
public float Friction { get; set; }
Property Value
Type | Description |
---|---|
float |
HasContactResponse
Gets a value indicating whether has contact response.
Declaration
public bool HasContactResponse { get; }
Property Value
Type | Description |
---|---|
bool |
HitFraction
Gets or sets the hit fraction.
Declaration
public float HitFraction { get; set; }
Property Value
Type | Description |
---|---|
float |
InternalBody
Gets the internal body.
Declaration
public object InternalBody { get; }
Property Value
Type | Description |
---|---|
object |
InterpolationAngularVelocity
Gets or sets the angular velocity interpolated.
Declaration
public Vector3 InterpolationAngularVelocity { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
InterpolationLinearVelocity
Gets or sets the linear velocity interpolated.
Declaration
public Vector3 InterpolationLinearVelocity { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
InterpolationWorldTransform
Gets or sets the world transform interpolated.
Declaration
public Matrix4x4 InterpolationWorldTransform { get; set; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
IsActive
Gets a value indicating whether this body is active.
Declaration
public bool IsActive { get; }
Property Value
Type | Description |
---|---|
bool |
IsKinematicObject
Gets a value indicating whether this body is kinematic.
Declaration
public virtual bool IsKinematicObject { get; }
Property Value
Type | Description |
---|---|
bool |
IsSensor
Gets or sets a value indicating whether this body collects contact information but never generates a collision response.
Declaration
public bool IsSensor { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsStaticObject
Gets a value indicating whether this body is static.
Declaration
public virtual bool IsStaticObject { get; }
Property Value
Type | Description |
---|---|
bool |
IsStaticOrKinematicObject
Gets a value indicating whether this body is kinematic or kinematic.
Declaration
public bool IsStaticOrKinematicObject { get; }
Property Value
Type | Description |
---|---|
bool |
IslandTag
Gets or sets the island tag.
Declaration
public int IslandTag { get; set; }
Property Value
Type | Description |
---|---|
int |
MaskBits
Gets or sets the collision mask bits.
Declaration
public CollisionCategory3D MaskBits { get; set; }
Property Value
Type | Description |
---|---|
CollisionCategory3D |
Restitution
Gets or sets the restitution of the rigid body.
Declaration
public float Restitution { get; set; }
Property Value
Type | Description |
---|---|
float |
RollingFriction
Gets or sets the rolling friction.
Declaration
public float RollingFriction { get; set; }
Property Value
Type | Description |
---|---|
float |
SpinningFriction
Gets or sets the spinning fraction.
Declaration
public float SpinningFriction { get; set; }
Property Value
Type | Description |
---|---|
float |
Transform
Gets the world transform of the body.
Declaration
public Matrix4x4 Transform { get; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
Methods
AddColliderShape(IColliderShape3D)
Add collider shape to the body.
Declaration
public virtual void AddColliderShape(IColliderShape3D shape)
Parameters
Type | Name | Description |
---|---|---|
IColliderShape3D | shape | The shape. |
BaseAddToWorld()
Add this body to the world simulation.
Declaration
protected virtual void BaseAddToWorld()
BaseInstantiateCollisionObject(PhysicBodyDef3D)
Base method of physic body instantiation.
Declaration
protected void BaseInstantiateCollisionObject(PhysicBodyDef3D bodyDef)
Parameters
Type | Name | Description |
---|---|---|
PhysicBodyDef3D | bodyDef | The body definition. |
BaseRemoveFromWorld()
Remove physic body from simulation world.
Declaration
protected virtual void BaseRemoveFromWorld()
ComputeTransform(ref Vector3, ref Quaternion, out Matrix4x4)
Compute a transform from translation and orientation. It applies the world scale.
Declaration
protected void ComputeTransform(ref Vector3 position, ref Quaternion orientation, out Matrix4x4 transform)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | The position. |
Quaternion | orientation | The orientation. |
Matrix4x4 | transform | The transform. |
Destroy()
Destroys all resources of this instance.
Declaration
protected override void Destroy()
Overrides
GetColliderShapeByIndex(int)
Gets collider shape by index.
Declaration
public IColliderShape3D GetColliderShapeByIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index. |
Returns
Type | Description |
---|---|
IColliderShape3D | The collider shape. |
GetColliderShapeIndex(BulletCollider3D)
Gets shpae index of the specified collider.
Declaration
public int GetColliderShapeIndex(BulletCollider3D shape)
Parameters
Type | Name | Description |
---|---|---|
BulletCollider3D | shape | The collider shape. |
Returns
Type | Description |
---|---|
int | The index. |
InstantiateCollisionObject(PhysicBodyDef3D)
Create the rigid body.
Declaration
protected abstract void InstantiateCollisionObject(PhysicBodyDef3D bodyDef)
Parameters
Type | Name | Description |
---|---|---|
PhysicBodyDef3D | bodyDef | The body definition. |
RemoveColliderShape(IColliderShape3D)
Remove collider shape to the body.
Declaration
public virtual void RemoveColliderShape(IColliderShape3D shape)
Parameters
Type | Name | Description |
---|---|---|
IColliderShape3D | shape | The shape to remove. |
SetTransform(Vector3, Quaternion, Vector3)
Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior.
Declaration
public virtual void SetTransform(Vector3 position, Quaternion orientation, Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | the world position of the body's local origin. |
Quaternion | orientation | the world rotation as a quaternion. |
Vector3 | scale | the world scale. |