PhysicsGroupclass

Represents a set of PhysicsBody objects. Think ragdoll.

objectPhysicsGroup
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.PhysicsGroup

Methods9

Showing 9 methods

public void AddAngularVelocity(Vector3 vel)PUBLIC

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

ParameterTypeDescription
velVector3How much angular force to add?
Returns:void

public void AddVelocity(Vector3 vel)PUBLIC

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

ParameterTypeDescription
velVector3How much linear force to add?
Returns:void

public void ApplyAngularImpulse(Vector3 vel, bool withMass = False)PUBLIC

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

ParameterTypeDescription
velVector3Angular velocity to apply.
withMass = FalseboolWhether to multiply the velocity by mass of the `Sandbox.PhysicsBody` on a per-body basis.
Returns:void

public void ApplyImpulse(Vector3 vel, bool withMass = False)PUBLIC

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

ParameterTypeDescription
velVector3Velocity to apply.
withMass = FalseboolWhether to multiply the velocity by mass of the `Sandbox.PhysicsBody` on a per-body basis.
Returns:void

public void RebuildMass()PUBLIC

Calls `Sandbox.PhysicsBody.RebuildMass` on all bodies of this group.

Returns:void

public void Remove()PUBLIC

Delete this group, and all of its bodies

Returns:void

public void SetSurface(string name)PUBLIC

Sets the physical properties of each PhysicsShape of this group.

ParameterTypeDescription
namestring
Returns:void

Properties12

Showing 12 properties

public float Sandbox.PhysicsGroup.AngularDamping { get; set; }PUBLICGETSET

Sets `Sandbox.PhysicsBody.AngularDamping` on all bodies in this group.

Returns:float

public Vector3 Sandbox.PhysicsGroup.AngularVelocity { get; set; }PUBLICGETSET

Sets `Sandbox.PhysicsBody.AngularVelocity` on all bodies of this group.

Returns:Vector3

public System.Collections.Generic.IEnumerable`1<Sandbox.PhysicsBody> Sandbox.PhysicsGroup.Bodies { get; set; }PUBLICGETSET

Returns all physics bodies that belong to this physics group.

Returns:IEnumerable<PhysicsBody>

public int Sandbox.PhysicsGroup.BodyCount { get; set; }PUBLICGETSET

Returns amount of physics bodies that belong to this physics group.

Returns:int

public System.Collections.Generic.IEnumerable`1<Sandbox.Physics.PhysicsJoint> Sandbox.PhysicsGroup.Joints { get; set; }PUBLICGETSET

Any and all joints that are attached to any body in this group.

Returns:IEnumerable<PhysicsJoint>

public float Sandbox.PhysicsGroup.LinearDamping { get; set; }PUBLICGETSET

Sets `Sandbox.PhysicsBody.LinearDamping` on all bodies in this group.

Returns:float

public float Sandbox.PhysicsGroup.Mass { get; set; }PUBLICGETSET

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.

Returns:float

public Vector3 Sandbox.PhysicsGroup.MassCenter { get; set; }PUBLICGETSET

Returns the center of mass for this group of physics bodies.

Returns:Vector3

public Vector3 Sandbox.PhysicsGroup.Pos { get; set; }PUBLICGETSET

Returns position of the first physics body of this group, or zero vector if it has none.

Note

TODO: How useful is this in its current form? Should it be removed, or at least renamed to Position?

Returns:Vector3

public bool Sandbox.PhysicsGroup.Sleeping { get; set; }PUBLICGETSET

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.

Returns:bool

public Vector3 Sandbox.PhysicsGroup.Velocity { get; set; }PUBLICGETSET

Sets `Sandbox.PhysicsBody.Velocity` on all bodies of this group.

Returns:Vector3

On this page