Skip to main content

Shape

The Scene class provides an interface for Scene shapes. It defines geometry used for collision detection between bodies and objects. Shape mass properties can be defined using either a mass value or density.

#include <scene/TellusimShape.h>

Constructors

Shape()

Methods

static Shape create(Type type, const char *name = nullptr)

Clear shape.

void clear()

Shape type.

Type getType() const
static const char *getTypeName(Type type)
const char *getTypeName() const
bool isBox() const
bool isSphere() const
bool isCapsule() const
bool isCylinder() const
bool isConvex() const
bool isMesh() const

Shape unique identifier.

uint32_t getID() const

Shape index.

uint32_t getIndex() const

Shape address.

uint32_t getAddress() const

Shape name.

void setName(const char *name)
void setName(const String &name)
String getName() const

Shape body.

void setBody(Body &body, bool check = true)
const Body getBody() const
Body getBody()

Shape object.

void setObject(Object &object, bool check = true)
const Object getObject() const
Object getObject()

Enabled flag.

void setEnabled(bool enabled)
bool isEnabled() const

Object mask.

void setObjectMask(uint32_t mask)
uint32_t getObjectMask() const

Tracer mask.

void setTracerMask(uint32_t mask)
uint32_t getTracerMask() const

Collider mask.

void setColliderMask(uint32_t mask)
uint32_t getColliderMask() const

Hidden flag.

void setHidden(bool flag)
bool isHidden() const

Internal flag.

void setInternal(bool flag)
bool isInternal() const

Virtual flag.

void setVirtual(bool flag)
bool isVirtual() const

Changed flag.

void setChanged(bool flag)
bool isChanged() const

Shape mass.

void setMass(float32_t mass)
float32_t getMass(bool force = false) const

Shape density.

void setDensity(float32_t density)
float32_t getDensity(bool force = false) const

Shape friction.

void setFriction(float32_t friction)
float32_t getFriction() const

Shape restitution.

void setRestitution(float32_t restitution)
float32_t getRestitution() const

Shape volume.

void setVolume(float32_t volume)
float32_t getVolume() const

Shape bound box.

void setBoundBox(BoundBoxf box)
const BoundBoxf getBoundBox() const

Inertia tensor.

void setInertia(Matrix4x3f inertia)
const Matrix4x3f getInertia() const

Shape transform.

void setTransform(Matrix4x3f transform)
const Matrix4x3f getTransform() const

Load shape.

bool load(const Xml &xml)
bool load(const Json &json)
bool load(Stream &stream)

Save shape.

bool save(Xml &xml) const
bool save(Json &json) const
bool save(Stream &stream) const

Clone shape.

Shape clone(Body &body) const
Shape clone(Object &object) const

Copy shape.

void copy(const Shape &shape)

Updated flag.

bool isUpdated() const

Update scene.

void updateScene()

Enums

Type

Shape types.

NameValue
TypeUnknown0
TypeBox1
TypeSphere2
TypeCapsule3
TypeCylinder4
TypeConvex5
TypeMesh6
NumTypes7