## Libraries.Game.Collision.Shapes.Sphere Documentation

This class describes the sphere shape in 3

*Inherits from: *Libraries.Language.Object, Libraries.Game.Collision.Shapes.CollisionShape3D

## Summary

### Actions Summary Table

Actions | Description |
---|---|

CalculateLocalInertia(number mass, Libraries.Compute.Vector3 inertia) | This action approximates the inertia of the spher |

CalculateTemporalBoundingBox(Libraries.Game.Collision.PhysicsPosition3D currentTransform, Libraries.Compute.Vector3 linearVelocity, Libraries.Compute.Vector3 angularVelocity, number timeStep, Libraries.Game.BoundingBox temporalBoundingBox) | This action calculates the rectangular cube that will contain both the object in its position currently and also contain the object in a position after "timeStep" seconds from no |

Compare(Libraries.Language.Object object) | This action compares two object hash codes and returns an integer. |

ComputeBoundingBox(Libraries.Game.BoundingBox boundingBox, Libraries.Game.Collision.PhysicsPosition3D transform) | This action finds the bounding box that would bound the Sphere in its current positio |

Copy() | This action sets another sphere to have the properties of the current spher |

Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their hash code values. |

GetAngularMotionDisc() | This calculates the maximum distance between any point to the center of the 3D objec |

GetBoundingSphere(Libraries.Compute.Vector3 center) | This action finds the center (relative to the object's local origin) and the radius of a sphere that would bound the object that is at its current positio |

GetChildCount() | This action returns how many children shapes are attached to this spher |

GetHashCode() | This action gets the hash code for an object. |

GetLocalScaling(Libraries.Compute.Vector3 out) | This action returns how the 3D object has been scaled to the shape that it has right no |

GetMargin() | This action returns the thickness of the "shell" that will surround this Sphere to prevent objects going through each other graphicall |

GetNumberPreferredPenetrationDirections() | This action calculates the preferred number of directions to check if another object has penetrated this spher |

GetPreferredPenetrationDirection(integer index, Libraries.Compute.Vector3 penetrationVector) | This action calculates one of the directions to check if another object has penetrated this sphere. |

GetRadius() | This action returns the radius of the Spher |

GetType() | This action returns what type of 3D object the 3D object i |

LocalGetSupportingVertex(Libraries.Compute.Vector3 vector) | This action returns the offset of the box that will bound the object to prevent objects going through each other graphicall |

LocalGetSupportingVertexWithoutMargin(Libraries.Compute.Vector3 vector) | This action finds the vertex that is furthest away in a direction specified by "Vector3 vector" that doesn't have an offse |

Scale(Libraries.Compute.Vector3 scale) | This action sets how big the 3D object is, scaling from the current size of the 3D objec |

Set(number radius) | This action sets the radius of the Spher |

SetLocalScaling(Libraries.Compute.Vector3 scaling) | This action sets how big the 3D object is, scaling from the default size of the 3D objec |

SetMargin(number margin) | This action sets the thickness of the "shell" that will surround this Sphere to prevent objects going through each other graphicall |

SetRadius(number radius) | This action sets the radius of the Spher |

SetType(integer type) | This action sets what type of 3D object this 3D object i |

## Actions Documentation

### CalculateLocalInertia(number mass, Libraries.Compute.Vector3 inertia)

This action approximates the inertia of the spher

#### Parameters

### CalculateTemporalBoundingBox(Libraries.Game.Collision.PhysicsPosition3D currentTransform, Libraries.Compute.Vector3 linearVelocity, Libraries.Compute.Vector3 angularVelocity, number timeStep, Libraries.Game.BoundingBox temporalBoundingBox)

This action calculates the rectangular cube that will contain both the object in its position currently and also contain the object in a position after "timeStep" seconds from no

#### Parameters

- Libraries.Game.Collision.PhysicsPosition3D
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- Libraries.Game.BoundingBox

### Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

**Example Code**

```
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smalle
```

#### Parameters

- Libraries.Language.Object: The object to compare to.

#### Return

integer: The Compare result, Smaller, Equal, or Larger.

### ComputeBoundingBox(Libraries.Game.BoundingBox boundingBox, Libraries.Game.Collision.PhysicsPosition3D transform)

This action finds the bounding box that would bound the Sphere in its current positio

#### Parameters

### Copy()

This action sets another sphere to have the properties of the current spher

#### Return

Libraries.Game.Collision.Shapes.CollisionShape3D:

### Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

**Example Code**

```
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(
```

#### Parameters

- Libraries.Language.Object: The to be compared.

#### Return

boolean: True if the hash codes are equal and false if they are not equal.

### GetAngularMotionDisc()

This calculates the maximum distance between any point to the center of the 3D objec

#### Return

number:

### GetBoundingSphere(Libraries.Compute.Vector3 center)

This action finds the center (relative to the object's local origin) and the radius of a sphere that would bound the object that is at its current positio

#### Parameters

#### Return

number:

### GetChildCount()

This action returns how many children shapes are attached to this spher

#### Return

integer:

### GetHashCode()

This action gets the hash code for an object.

**Example Code**

```
Object o
integer hash = o:GetHashCode
```

#### Return

integer: The integer hash code of the object.

### GetLocalScaling(Libraries.Compute.Vector3 out)

This action returns how the 3D object has been scaled to the shape that it has right no

#### Parameters

#### Return

### GetMargin()

This action returns the thickness of the "shell" that will surround this Sphere to prevent objects going through each other graphicall

#### Return

number:

### GetNumberPreferredPenetrationDirections()

This action calculates the preferred number of directions to check if another object has penetrated this spher

#### Return

integer:

### GetPreferredPenetrationDirection(integer index, Libraries.Compute.Vector3 penetrationVector)

This action calculates one of the directions to check if another object has penetrated this sphere. Since sphere is a special case, this action doesn't do anythin

#### Parameters

### GetRadius()

This action returns the radius of the Spher

#### Return

number:

### GetType()

This action returns what type of 3D object the 3D object i

#### Return

integer:

### LocalGetSupportingVertex(Libraries.Compute.Vector3 vector)

This action returns the offset of the box that will bound the object to prevent objects going through each other graphicall

#### Parameters

#### Return

### LocalGetSupportingVertexWithoutMargin(Libraries.Compute.Vector3 vector)

This action finds the vertex that is furthest away in a direction specified by "Vector3 vector" that doesn't have an offse

#### Parameters

#### Return

### Scale(Libraries.Compute.Vector3 scale)

This action sets how big the 3D object is, scaling from the current size of the 3D objec

#### Parameters

### Set(number radius)

This action sets the radius of the Spher

#### Parameters

### SetLocalScaling(Libraries.Compute.Vector3 scaling)

This action sets how big the 3D object is, scaling from the default size of the 3D objec

#### Parameters

### SetMargin(number margin)

This action sets the thickness of the "shell" that will surround this Sphere to prevent objects going through each other graphicall

#### Parameters

### SetRadius(number radius)

This action sets the radius of the Spher

#### Parameters

### SetType(integer type)

This action sets what type of 3D object this 3D object i