Api Sandbox PhysicsGroup
class

PhysicsGroup

public sealed class PhysicsGroup

Represents a set of PhysicsBody objects. Think ragdoll.

Properties

Name Type Description
World PhysicsWorld The world in which this group belongs
Pos Vector3 Returns position of the first physics body of this group, or zero vector if it has none.
MassCenter Vector3 Returns the center of mass for this group of physics bodies.
Velocity Vector3 Sets Velocity on all bodies of this group.
AngularVelocity Vector3 Sets AngularVelocity on all bodies of this group.
Sleeping Boolean Physics bodies automatically go to sleep after a certain amount of time of inactivity to save on performance. You can use this to wake the body up, or prematurely send it to sleep.
Mass Single The total mass of all the dynamicPhysicsBodies in this group. When setting the total mass, it will be set on each body proportionally to each of their old masses, i.e. if a body had 25% of previous total mass, it will have 25% of new total mass.
LinearDamping Single Sets LinearDamping on all bodies in this group.
AngularDamping Single Sets AngularDamping on all bodies in this group.
Bodies IEnumerable<PhysicsBody> Returns all physics bodies that belong to this physics group.
BodyCount Int32 Returns amount of physics bodies that belong to this physics group.
Joints IEnumerable<PhysicsJoint> Any and all joints that are attached to any body in this group.

Methods

Void AddVelocity(Vector3 vel)

Adds given amount of velocity (ApplyForce(Vector3)) to all physics bodies in this group.

vel — How much linear force to add?
Void AddAngularVelocity(Vector3 vel)

Adds given amount of angular velocity to all physics bodies in this group.

vel — How much angular force to add?
Void ApplyImpulse(Vector3 vel, Boolean withMass = False)

Adds given amount of linear impulse (ApplyImpulse(Vector3)) to all physics bodies in this group.

vel — Velocity to apply.
withMass — Whether to multiply the velocity by mass of the PhysicsBody on a per-body basis.
Void ApplyAngularImpulse(Vector3 vel, Boolean withMass = False)

Adds given amount of angular linear impulse (ApplyAngularImpulse(Vector3)) to all physics bodies in this group.

vel — Angular velocity to apply.
withMass — Whether to multiply the velocity by mass of the PhysicsBody on a per-body basis.
Void RebuildMass()

Calls RebuildMass on all bodies of this group.

PhysicsBody GetBody(Int32 groupIndex)

Gets a PhysicsBody at given index within this physics group. See BodyCount.

groupIndex — Index for the body to look up, in range from 0 to BodyCount.
PhysicsBody GetBody(String groupName)

Returns a PhysicsBody by its GroupName within this group.

groupName — Name of the physics body to look up.
returns — The physics body, or null if body with given name is not found.
Void SetSurface(String name)

Sets the physical properties of each PhysicsShape of this group.

Void Remove()

Delete this group, and all of its bodies

Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.PhysicsGroup