Deleting a Body shape question [solved]

OgreMage

11-05-2008 19:04:24

Hello NxOgre'ers, I have a NxOgre C++ question in regards to destroying a Body created with createBody.

Typically, the way Body's are created appears to be:

Body* boxBody = mPhysicsScene->createBody("box.mesh", new CubeShape(1,1,1), Vector3(0,0,0), "mass: 10");
My question is, when the body is deleted (I currently use mWorld->destroyScene but have used mPhysicsScene->destroyBody in the past), is the CubeShape deleted? It was created with new, so how is it being deleted? And if not, what is the suggested way to do so cleanly (i.e. a scene with many Body's).

Thank you dearly,
OM

betajaen

11-05-2008 19:47:10

NxOgre will clean everything like that up for you. Everything has to be created through a factory (createXXX) and destroyed (destroyXXX). Shape is the only exception, but the Actor will destroy all shapes once it is destroyed.

So there is nothing to worry about.

OgreMage

11-05-2008 20:19:17

Excellent, thank you, tagging as [solved]