Hi
I've written a particle engine, and decided to try to simulate a cloth. Mostly because I want to test the speed of C++ since I'm used to Flash but I also want to see if it's possible to use it in a game. Anyway, I got an array of particles and I want to pass that to a function which creates a cloth of them. Here's the code:
Code:
void createCloth(int numOfParticles, cParticle* particles[])
{
cParticle* tPart;
for (int i=0; i < (int)sqrt((float)numOfParticles); i++)
{
for (int j=0; j < (int)sqrt((float)numOfParticles); j++)
{
tPart = particles[10*i+j];
tPart->init(j/10, i/10, 0, 0, 0, 0, 0.5);
}
}
for (int i=0; i < (int)sqrt((float)numOfParticles); i++)
{
for (int j=0; j < (int)sqrt((float)numOfParticles); j++)
{
tPart = particles[10*i+j];
if (j != 0) tPart->addConstraint(&particles[i+j-1], 0.1, false);
if (j!= (int)sqrt((float)numOfParticles)-1) tPart->addConstraint(&particles[i+j+1], 0.1, false);
if (i != 0) tPart->addConstraint(&particles[10*i+j-10], 0.1, false);
if (i != (int)sqrt((float)numOfParticles)-1) tPart->addConstraint(&particles[10*i+j+10], 0.1, false);
}
}
}
//Heres the call for it, along with the array (in winMain function):
cParticle particles[numParticles];
createCloth(numParticles, &particles);
I get the error:
error C2664: 'createCloth' : cannot convert parameter 2 from 'cParticle (*__w64 )[100]' to 'cParticle *'
I've tried anything I can think of, but nothing works. Anyone knows what might be wrong?
Thanks in advance
The Wazaa