Moderators: Sascha Willems, walaber
Collision::Collision( const Collision& shape) : m_col(shape.m_col)
{
m_world = shape.m_world;
if (m_col) {
NewtonAddCollisionReference (m_col); /// Identifier not found
}
}
Collision::Collision(const NewtonCollision* collision, const World* world) : m_col((NewtonCollision*)collision)
{
m_world = world;
NewtonAddCollisionReference (m_col); /// Identifier not found
}
Collision::~Collision()
{
if (m_world->getNewtonWorld() && m_col)
{
NewtonReleaseCollision( m_world->getNewtonWorld(), m_col ); /// Identifier not found
}
}
void Collision::makeUnique()
{
NewtonCollisionMakeUnique( m_world->getNewtonWorld(), m_col ); /// Identifier not found
}
Collision::Collision( const Collision& shape)
:m_world(m_world)
: m_col(shape.m_col ? NewtonCollisionCreateInstance(shape.m_col) : NULL)
{
// m_world = shape.m_world;
// if (m_col) {
// NewtonAddCollisionReference (m_col); /// Identifier not found
// }
}
Collision::Collision(const NewtonCollision* collision, const World* world)
: m_world (world)
, m_col(NewtonCollisionCreateInstance(m_col))
{
// m_world = world;
// NewtonAddCollisionReference (m_col); /// Identifier not found
}
Collision::~Collision()
{
if (m_world->getNewtonWorld() && m_col)
{
// all collision are instances now
//NewtonReleaseCollision( m_world->getNewtonWorld(), m_col ); /// Identifier not found
NewtonDestroyCollision(m_col);
}
}
void Collision::makeUnique()
{
// all collision are instances now
//NewtonCollisionMakeUnique( m_world->getNewtonWorld(), m_col ); /// Identifier not found
}
m_col = NewtonCreateCompoundCollision( world->getNewtonWorld(), id );
m_body = NewtonCreateBody( m_world->getNewtonWorld(), m_col, &posit[0][0] ); //here my app crashes
m_col = NewtonCreateCompoundCollision( world->getNewtonWorld(), id );
NewtonCompoundCollisionBeginAddRemove (m_col);
NewtonCompoundCollisionAddSubCollision(m_col, NewtonCreateNull( world->getNewtonWorld(), id);
NewtonCompoundCollisionEndAddRemove (m_col);
m_body = NewtonCreateBody( m_world->getNewtonWorld(), m_col, &posit[0][0] );
m_col = NewtonCreateCompoundCollision( world->getNewtonWorld(), id );
m_body = NewtonCreateBody( m_world->getNewtonWorld(), m_col, &posit[0][0] ); //here my app crashes
m_col = NewtonCreateCompoundCollision( world->getNewtonWorld(), id );
NewtonCompoundCollisionBeginAddRemove (m_col);
NewtonCompoundCollisionAddSubCollision(m_col, NewtonCreateNull( world->getNewtonWorld(), id);
NewtonCompoundCollisionEndAddRemove (m_col);
m_body = NewtonCreateBody( m_world->getNewtonWorld(), m_col, &posit[0][0] );
NewtonCollision* const coll = NewtonCreateCompoundCollision( world->getNewtonWorld(), id );
NewtonCompoundCollisionBeginAddRemove (coll);
NewtonCompoundCollisionAddSubCollision(coll, NewtonCreateNull( world->getNewtonWorld(), id);
NewtonCompoundCollisionEndAddRemove (coll);
m_body = NewtonCreateBody( m_world->getNewtonWorld(), coll, &posit[0][0] );
NewtonDestroyCollision(coll);
// now if you want to have a shortcut to teh collisionb you do this.
m_coll = NewtonBodyGetCollision(body);
NewtonCollision* const coll = NewtonCreateCompoundCollision( world->getNewtonWorld(), id );
m_body = NewtonCreateBody( m_world->getNewtonWorld(), coll, &posit[0][0] );
NewtonDestroyCollision(coll);
// now if you want to have a shortcut to teh collisionb you do this.
m_coll = NewtonBodyGetCollision(body);
NewtonCompoundCollisionBeginAddRemove (m_coll);
NewtonCompoundCollisionAddSubCollision(m_coll, anyConvexcollisionYouWant, id);
NewtonCompoundCollisionEndAddRemove (m_coll);
//test Yeside compound shape shape
NewtonCompoundCollisionBeginAddRemove(compound);
NewtonCollision* collision;
dMatrix offsetMatrix (dPitchMatrix(1.5708f));
offsetMatrix.m_posit.m_z = 0.115947f;
collision = NewtonCreateCylinder (world, 0.021f, 0.096f, 0, &offsetMatrix[0][0]) ;
NewtonCompoundCollisionAddSubCollision (compound, collision);
NewtonDestroyCollision(collision);
offsetMatrix.m_posit.m_z = 0.035182f;
collision = NewtonCreateCylinder (world, 0.0065f, 0.07f, 0, &offsetMatrix[0][0]) ;
NewtonCompoundCollisionAddSubCollision (compound, collision);
NewtonDestroyCollision(collision);
offsetMatrix.m_posit.m_z = 0.147914f;
collision = NewtonCreateCylinder (world, 0.195f, 0.024f, 0, &offsetMatrix[0][0]) ;
NewtonCompoundCollisionAddSubCollision (compound, collision);
NewtonDestroyCollision(collision);
NewtonCompoundCollisionEndAddRemove(compound);
PJani wrote:One more question... Are compound indexes continues allways and are node void* allways the same for compound nodes even after adding or removing of nodes?
Julio Jerez wrote:you can look at the node as a handle. that never changes memory locations. this is a tecnique I use a lot.
Users browsing this forum: No registered users and 0 guests