Class R.collision.ConvexHull
Extends
R.engine.PooledObject.
A convex hull with which to perform collision testing. A convex hull
is a simplification of the points which either comprise an object, or
the points around an object. There are two simplified hull types which
can also be used: R.collision.OBBHull and R.collision.CircleHull
Defined in: convexhull.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.collision.ConvexHull(points, lod)
Create a polygonal convex hull which has, at most, lod vertexes.
|
Field Attributes | Field Name and Description |
---|---|
A circular convex hull shape (center and radius)
|
|
An N-gon convex hull shape (3 or more vertexes)
|
Method Attributes | Method Name and Description |
---|---|
destroy()
Destroy the object
|
|
Get the point at the center of the convex hull
|
|
Get the class name of this object
|
|
Get the object which is using this collision hull.
|
|
Deprecated in favor of #getGameObject.
|
|
Get the radius (distance to farthest point in shape, from center)
|
|
getType()
Return the type of convex hull this represents.
|
|
Get the array of untransformed vertexes in the convex hull
|
|
Get the array of vertexes in the convex hull
|
|
release()
Return the object to the pool
|
|
setGameObject(hostObj)
Set the object which is using this collision hull.
|
|
setHostObject(obj)
Deprecated in favor of #setGameObject
|
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.collision.ConvexHull(points, lod)
Create a polygonal convex hull which has, at most, lod vertexes.
- Parameters:
- points
- {Array} An array of R.math.Point2D which make up the shape to create the hull from.
- lod Optional
- {Number} The level of detail for the hull. Larger numbers make for a more complex hull. Points will not be created if the number of points availble is less than the LOD. Default: 4
Field Detail
CONVEX_CIRCLE
A circular convex hull shape (center and radius)
CONVEX_NGON
An N-gon convex hull shape (3 or more vertexes)
Method Detail
destroy()
Destroy the object
{R.math.Point2D}
getCenter()
Get the point at the center of the convex hull
- Returns:
- {R.math.Point2D}
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} "R.collision.ConvexHull"
{R.objects.Object2D}
getGameObject()
Get the object which is using this collision hull.
- Returns:
- {R.objects.Object2D}
getHostObject()
Deprecated in favor of #getGameObject.
{Number}
getRadius()
Get the radius (distance to farthest point in shape, from center)
- Returns:
- {Number}
{Number}
getType()
Return the type of convex hull this represents.
- Returns:
- {Number} #CONVEX_NGON
{Array}
getUntransformedVertexes()
Get the array of untransformed vertexes in the convex hull
- Returns:
- {Array} of R.math.Point2D
{Array}
getVertexes()
Get the array of vertexes in the convex hull
- Returns:
- {Array} of R.math.Point2D
release()
Return the object to the pool
setGameObject(hostObj)
Set the object which is using this collision hull.
- Parameters:
- hostObj
- {R.objects.Object2D} The object which is using the hull
setHostObject(obj)
Deprecated in favor of #setGameObject
- Parameters:
- obj