Class Box2DBodyComponent
Component that ties a Stride entity to a Box2D body: creation-time configuration plus live velocity, force and impulse access once BodyId refers to a created body.
[DataContract("Box2DBodyComponent")]
[Display("Box2D Body", null)]
[ComponentCategory("Physics")]
public class Box2DBodyComponent : EntityComponent, IIdentifiable
- Inheritance
-
Box2DBodyComponent
- Implements
- Inherited Members
Properties
AngularDamping
Angular damping used when the body is created.
public float AngularDamping { get; set; }
Property Value
AngularVelocity
The body's angular velocity in radians per second. Reads return zero and writes are ignored while BodyId is not a valid body.
[DataMemberIgnore]
public float AngularVelocity { get; set; }
Property Value
BodyId
The Box2D body backing this component. Default (invalid) until the body is created.
[DataMemberIgnore]
public B2BodyId BodyId { get; set; }
Property Value
- B2BodyId
BodyType
The body type used when the body is created.
public B2BodyType BodyType { get; set; }
Property Value
- B2BodyType
CollisionGroup
Collision group used with Box2DCollisionMatrix-style filtering.
public int CollisionGroup { get; set; }
Property Value
Friction
Friction coefficient used when shapes are created.
public float Friction { get; set; }
Property Value
IsSensor
Whether shapes created for this body should be sensors (detect contacts, no collision response).
public bool IsSensor { get; set; }
Property Value
LinearDamping
Linear damping used when the body is created.
public float LinearDamping { get; set; }
Property Value
LinearVelocity
The body's linear velocity. Reads return zero and writes are ignored while BodyId is not a valid body.
[DataMemberIgnore]
public Vector2 LinearVelocity { get; set; }
Property Value
Mass
Mass density used when shapes are created.
public float Mass { get; set; }
Property Value
Restitution
Restitution (bounciness) used when shapes are created.
public float Restitution { get; set; }
Property Value
Methods
ApplyForce(Vector2, Vector2?)
Applies a force to the body, waking it. Ignored while BodyId is not a valid body.
public void ApplyForce(Vector2 force, Vector2? point = null)
Parameters
forceVector2The force in newtons.
pointVector2?World-space application point; the center of mass when null.
ApplyImpulse(Vector2, Vector2?)
Applies a linear impulse to the body, waking it. Ignored while BodyId is not a valid body.
public void ApplyImpulse(Vector2 impulse, Vector2? point = null)
Parameters
impulseVector2The impulse in newton-seconds.
pointVector2?World-space application point; the center of mass when null.
ApplyTorque(float)
Applies a torque to the body, waking it. Ignored while BodyId is not a valid body.
public void ApplyTorque(float torque)
Parameters
torquefloatThe torque in newton-meters.