new Shape()
Shape is an abstract class that describes "physical", objects.
The main objective of a Shape is to serve as a bounding box. It
should play the main role when selecting the objects to render,
when it comes to collision detection and/or to detect user
interaction with an object.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
options.position |
Grape2D.Vector |
<optional> |
The position of the shape. |
- Source:
Members
-
<protected> position :Grape2D.Vector
-
Shape's position.
Type:
- Source:
Methods
-
createBV(bvfactory) → {Grape2D.Shape}
-
Creates a bounding volume, based in this one and in a Grape2D.BVFactory.
Parameters:
Name Type Description bvfactory
Grape2D.BVFactory The bounding volume factory. - Source:
Returns:
The shape created by the Grape2D.BVFactory.- Type
- Grape2D.Shape
-
getPosition() → {Grape2D.Vector}
-
Gets the position of the object.
- Source:
Returns:
The center position of the shape.- Type
- Grape2D.Vector
-
getStaticType() → {string}
-
Gets teh static type of the shape. This method must be overriden, for specific shapes.
- Source:
Returns:
The type of the shape.- Type
- string
-
render(renderer, camera)
-
Renders the wireframe of the shape.
Parameters:
Name Type Description renderer
Grape2D.Renderer The renderer to render the shape's wireframe. camera
Grape2D.Camera The camera to transform the positions. - Source:
-
setPosition(position)
-
Set the position of the shape.
Parameters:
Name Type Description position
Grape2D.Vector The new position of the shape. - Source: