class PhysicsGroup

in global :: Sandbox

Represents a set of PhysicsBody objects. Think ragdoll.


public PhysicsWorld World { get; }

The world in which this group belongs

public Vector3 Pos { get; }

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

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

public Vector3 MassCenter { get; }

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

public void AddVelocity( Vector3 vel )

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

  • vel How much linear force to add?

public void AddAngularVelocity( Vector3 vel )

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

  • vel How much angular force to add?

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

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

  • vel Velocity to apply.
  • withMass Whether to multiply the velocity by mass of the on a per-body basis.

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

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

  • vel Angular velocity to apply.
  • withMass Whether to multiply the velocity by mass of the on a per-body basis.

public Vector3 Velocity { set; }

Sets on all bodies of this group.

public Vector3 AngularVelocity { set; }

Sets on all bodies of this group.

public bool Sleeping { get; set; }

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.

public float Mass { get; set; }

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.

public float LinearDamping { set; }

Sets on all bodies in this group.

public float AngularDamping { set; }

Sets on all bodies in this group.

public IEnumerable<PhysicsBody> Bodies { get; }

Returns all physics bodies that belong to this physics group.

public int BodyCount { get; }

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

public PhysicsBody GetBody( int groupIndex )

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

  • groupIndex Index for the body to look up, in range from 0 to .

public PhysicsBody GetBody( string groupName )

Returns a by its 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.

public IEnumerable<PhysicsJoint> Joints { get; }

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

public void SetSurface( string name )

Sets the physical properties of each PhysicsShape of this group.

public bool Equals( object obj )

😔 No documentation found.

public void Remove( )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public void RebuildMass( )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.