Passing python list to a container argument

unkonstant

03-12-2008 14:13:00

Hello users,
I am new to python-ogre and python and I got a problem while creating a OgreNewt.CompoundCollision object which has the following constructor: __init__(struct _object *, class OgreNewt::World const * world, class std::vector<class OgreNewt::Collision *,class std::allocator<class OgreNewt::Collision *> > col_array)

I tried to create a list of Collision objects with the following code:

shapes = []
col = OgreNewt.Pyramid(self.world, Ogre.Vector3(5,5,5), Ogre.Quaternion(0, 0, 0), Ogre.Vector3(0,0,-20) )
shapes.append(col)
col2 = OgreNewt.Box(self.world, Ogre.Vector3(5,5,5) )
shapes.append(col2)
compound = OgreNewt.CompoundCollision(self.world, shapes)


Box and Pyramid are both subclasses of Collision. Python is saying that this lines do not match the signature. Whats the correct way to create a array of collisions / create a std::vector equivalent?

andy

03-12-2008 15:05:56

What you want is:shapes = OgreNewt.VectorofCollision()

Regards
Andy

unkonstant

03-12-2008 15:24:34

Exactly what I needed! Thank you very much!