com.badlogic.gdx.physics.box2d
Class Shape

java.lang.Object
  extended by com.badlogic.gdx.physics.box2d.Shape
Direct Known Subclasses:
ChainShape, CircleShape, EdgeShape, PolygonShape

public abstract class Shape
extends Object

A shape is used for collision detection. You can create a shape however you like. Shapes used for simulation in b2World are created automatically when a b2Fixture is created. Shapes may encapsulate a one or more child shapes. NOTE: YOU NEED TO DISPOSE SHAPES YOU CREATED YOURSELF AFTER YOU NO LONGER USE THEM! E.g. after calling body.createFixture();

Author:
mzechner

Nested Class Summary
static class Shape.Type
          Enum describing the type of a shape
 
Constructor Summary
Shape()
           
 
Method Summary
 void dispose()
          Needs to be called when the shape is no longer used, e.g.
 int getChildCount()
          Get the number of child primitives.
 float getRadius()
          Returns the radius of this shape
abstract  Shape.Type getType()
          Get the type of this shape.
 void setRadius(float radius)
          Sets the radius of this shape
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shape

public Shape()
Method Detail

getType

public abstract Shape.Type getType()
Get the type of this shape. You can use this to down cast to the concrete shape.

Returns:
the shape type.

getRadius

public float getRadius()
Returns the radius of this shape


setRadius

public void setRadius(float radius)
Sets the radius of this shape


dispose

public void dispose()
Needs to be called when the shape is no longer used, e.g. after a fixture was created based on the shape.


getChildCount

public int getChildCount()
Get the number of child primitives.



Copyright © 2013. All Rights Reserved.