Class PhysicsComponent
[DataContract("PhysicsComponent", Inherited = true)]
[Display("Physics", null, Expand = ExpandRule.Once)]
[DefaultEntityComponentProcessor(typeof(PhysicsProcessor))]
[ComponentOrder(3000)]
[ComponentCategory("Physics")]
public abstract class PhysicsComponent : ActivableEntityComponent, IIdentifiable
- Inheritance
-
PhysicsComponent
- Implements
- Derived
- Inherited Members
Constructors
PhysicsComponent()
protected PhysicsComponent()
Fields
BoneIndex
public int BoneIndex
Field Value
BoneWorldMatrix
public Matrix BoneWorldMatrix
Field Value
BoneWorldMatrixOut
public Matrix BoneWorldMatrixOut
Field Value
attachInProgress
protected bool attachInProgress
Field Value
colliderShape
protected ColliderShape colliderShape
Field Value
logger
protected static Logger logger
Field Value
Properties
CanCollideWith
Gets or sets the can collide with.
[DataMember(40)]
[Display("Collides with...", null)]
public CollisionFilterGroupFlags CanCollideWith { get; set; }
Property Value
- CollisionFilterGroupFlags
The can collide with.
Remarks
The collider will still produce events, to allow non trigger rigidbodies or static colliders to act as a trigger if required for certain filtering groups.
CanScaleShape
public bool CanScaleShape { get; set; }
Property Value
CanSleep
Gets or sets if this element can enter sleep state
[DataMember(55)]
[Display("Can sleep", null)]
public bool CanSleep { get; set; }
Property Value
- bool
true, false
CcdMotionThreshold
[DataMember(67)]
public float CcdMotionThreshold { get; set; }
Property Value
CcdSweptSphereRadius
[DataMember(68)]
public float CcdSweptSphereRadius { get; set; }
Property Value
ColliderShape
public virtual ColliderShape ColliderShape { get; set; }
Property Value
ColliderShapeChanged
public bool ColliderShapeChanged { get; }
Property Value
ColliderShapes
[DataMember(200)]
public PhysicsComponent.ColliderShapeCollection ColliderShapes { get; }
Property Value
CollisionGroup
Gets or sets the collision group.
[DataMember(30)]
[Display("Collision group", null)]
public CollisionFilterGroups CollisionGroup { get; set; }
Property Value
- CollisionFilterGroups
The collision group.
Remarks
The collider will still produce events, to allow non trigger rigidbodies or static colliders to act as a trigger if required for certain filtering groups.
Collisions
public TrackingHashSet<Collision> Collisions { get; }
Property Value
Data
protected PhysicsProcessor.AssociatedData Data { get; set; }
Property Value
DebugEntity
public Entity DebugEntity { get; set; }
Property Value
Enabled
Gets or sets if this element is enabled in the physics engine
[DataMember(-10)]
public override bool Enabled { get; set; }
Property Value
- bool
true, false
Friction
Gets or sets the friction of this element
[DataMember(65)]
public float Friction { get; set; }
Property Value
- float
true, false
Remarks
It's important to realise that friction and restitution are not values of any particular surface, but rather a value of the interaction of two surfaces. So why is it defined for each object? In order to determine the overall friction and restitution between any two surfaces in a collision.
IsActive
Gets a value indicating whether this instance is active (awake).
public bool IsActive { get; }
Property Value
- bool
true
if this instance is active; otherwise,false
.
PhysicsWorldTransform
public Matrix PhysicsWorldTransform { get; set; }
Property Value
ProcessCollisions
Gets or sets if this element will store collisions
[Display("Record collision events", null)]
[Obsolete("Always processed and stored by now")]
public bool ProcessCollisions { get; set; }
Property Value
- bool
true, false
Restitution
Gets or sets if this element restitution
[DataMember(60)]
public float Restitution { get; set; }
Property Value
- float
true, false
RollingFriction
Gets or sets the rolling friction of this element
[DataMember(66)]
public float RollingFriction { get; set; }
Property Value
- float
true, false
Simulation
public Simulation Simulation { get; }
Property Value
Tag
Gets or sets the tag.
public string Tag { get; set; }
Property Value
- string
The tag.
Methods
Activate(bool)
Attempts to awake the collider.
public void Activate(bool forceActivation = false)
Parameters
forceActivation
boolif set to
true
[force activation].
AddDebugEntity(Scene, RenderGroup, bool)
public void AddDebugEntity(Scene scene, RenderGroup renderGroup = RenderGroup.Group0, bool alwaysAddOffset = false)
Parameters
scene
ScenerenderGroup
RenderGroupalwaysAddOffset
bool
CollisionEnded()
public ChannelMicroThreadAwaiter<Collision> CollisionEnded()
Returns
ComposeShape()
Made virtual for added behavior in CharacterComponent with UAF exception
public virtual void ComposeShape()
IgnoreCollisionWith(PhysicsComponent, CollisionState)
public void IgnoreCollisionWith(PhysicsComponent other, CollisionState state)
Parameters
other
PhysicsComponentstate
CollisionState
IsIgnoringCollisionWith(PhysicsComponent)
public bool IsIgnoringCollisionWith(PhysicsComponent other)
Parameters
other
PhysicsComponent
Returns
NewCollision()
public ChannelMicroThreadAwaiter<Collision> NewCollision()
Returns
OnAttach()
Called whenever an entity with this component is added to scene.
protected virtual void OnAttach()
OnDetach()
protected virtual void OnDetach()
OnUpdateBones()
protected virtual void OnUpdateBones()
OnUpdateDraw()
protected virtual void OnUpdateDraw()
RemoveDebugEntity(Scene)
public void RemoveDebugEntity(Scene scene)
Parameters
scene
Scene
UpdatePhysicsTransformation(bool)
Forces an update from the TransformComponent to the Collider.PhysicsWorldTransform. Useful to manually force movements. In the case of dynamic rigidbodies a velocity reset should be applied first.
public void UpdatePhysicsTransformation(bool forceUpdateTransform = true)
Parameters
forceUpdateTransform
boolEnsure that the Transform.WorldMatrix we are reading from is up to date