[newb] For loop to create new collision shapes

aws357
Posts: 9
Joined: Tue Jul 03, 2007 8:20 am

[newb] For loop to create new collision shapes

Post by aws357 »

A really naive question from a python user to C++ users.

I would like to make a simple for loop to build n collision shapes.

This is a simplistic c++ code I came up with (of course it didn't work, or I wouldn't be bugging the forum)

Code: Select all

int* shapelist;

int limit=2000;

btCollisionShape* fallShape = new btSphereShape(btScalar(1));

shapelist=new btCollisionShape*[limit+1];

for (int i=0;i<=limit;i++){
  shapelist[i]=new btSphereShape(btScalar(1));
}
How would you rewrite that bit of code to do what I want it to do?