A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Auradrummer » Mon Dec 20, 2010 4:24 pm
Hello guys,
I have a project, where I need to create a compound collision with various objects parts. But, I'm using the same classes for different objects, so I need to pass a dynamic array of collisions to CreateCompoundCollision, instead of a static array.
But, when I do this (I'm using the 'array' class of Irrlicht) I receive a following compiler error message:
cannot convert `irr::core::array<NewtonCollision*, irr::core::irrAllocator<NewtonCollision*> >' to `NewtonCollision* const*' for argument `3' to `NewtonCollision* NewtonCreateCompoundCollision(const NewtonWorld*, int, NewtonCollision* const*, int)'
There is another way, or another class, to make this?
Thanks
Ney
Last edited by
Auradrummer on Tue Dec 21, 2010 8:22 am, edited 1 time in total.
Developing a racing game.
-
Auradrummer
-
- Posts: 132
- Joined: Sat May 17, 2008 9:17 am
by Julio Jerez » Mon Dec 20, 2010 5:40 pm
why don't yo just make an array of pointers on the stack and copy the shapes?
if teh array is flat in memory, you could also take the adress of the first elemet of you dynamics array,
& irr::core::irrAllocator<NewtonCollision*>>[0]
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Auradrummer » Tue Dec 21, 2010 8:14 am
Hello Master,
I tried this before, I made the following line:
- Code: Select all
NewtonCollision * airplane = NewtonCreateCompoundCollision(nWorld, pieces.size(), pieces[0], 30);
where
- Code: Select all
array <NewtonCollision *> pieces;
I'm still getting the compiler error:
'cannot convert `NewtonCollision*' to `NewtonCollision* const*' for argument `3' to `NewtonCollision* NewtonCreateCompoundCollision(const NewtonWorld*, int, NewtonCollision* const*, int)'
Type casting doesn't worked too... I'll keep trying.
Thanks
Developing a racing game.
-
Auradrummer
-
- Posts: 132
- Joined: Sat May 17, 2008 9:17 am
by Auradrummer » Tue Dec 21, 2010 8:22 am
Solved Master,
I made an conceptual programming error.
I need to pass the address of the first pointer, as you said, and not the address of first collision. So, I have to pass a pointer to pointer.
This way, I have to:
- Code: Select all
array <NewtonCollision *> pieces;
NewtonCollision * mesh = NewtonCreateCompoundCollision(nWorld, pieces.size(),&pieces[0], 30);
and not (without the reference pointer)
- Code: Select all
NewtonCollision * mesh = NewtonCreateCompoundCollision(nWorld, pieces.size(),pieces[0], 30);
Worked well.
Developing a racing game.
-
Auradrummer
-
- Posts: 132
- Joined: Sat May 17, 2008 9:17 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 2 guests