I think there will be a need to rebuild the triangle selector at each frame if you need to update it with moving objects.
I think this would be needed:
- put all the static objects (collisions) in a triangle selector. Find a way to copy it.
- Update the triangle selector with the other moving meshes
On the next refresh, you take back the copy of the triangle selector and update it ONLY with the moving meshes.
As a C++ NOOB question, is there a way to copy the triangle selector, to do what I'm talking about?
Collision mesh.
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
No, actually, animating the meshes animate the collision triangles, or at least, i could animate one object, and the collision animated with it. The real trouble of animating the collision meshes is that the simulation is static, i mean, the only simulation done is a collision test, it is not calculated any drag, or any thing outside a collision test.
It is better understood with a moving example, try perhaps this. Create a room, a small cube, and a sphere. Make the collision meshes out of the room and the cube, and add the collision animator to the sphere. Then, animate the cube rotating it in the y axis, and let the sphere fall over the cube. The effect of this is that the sphere will keep over the cube, and won't move or follow the cube. Then, if you spin the cube in the X axis, the sphere will fall, and the cube won't affect it at all.
The reason for this is that the collision test is static as it is implemented in Irrlicht, it doesn't make any simulation along the time, it doesn't know really if the objects are moving or not, so, even in the case that you could rebuild the triangle selector for every frame, it would be all the time the same, and it would only work correctly for static meshes.
I wonder how the moving platforms of Quake were implemented. They reacted really cool
It is better understood with a moving example, try perhaps this. Create a room, a small cube, and a sphere. Make the collision meshes out of the room and the cube, and add the collision animator to the sphere. Then, animate the cube rotating it in the y axis, and let the sphere fall over the cube. The effect of this is that the sphere will keep over the cube, and won't move or follow the cube. Then, if you spin the cube in the X axis, the sphere will fall, and the cube won't affect it at all.
The reason for this is that the collision test is static as it is implemented in Irrlicht, it doesn't make any simulation along the time, it doesn't know really if the objects are moving or not, so, even in the case that you could rebuild the triangle selector for every frame, it would be all the time the same, and it would only work correctly for static meshes.
I wonder how the moving platforms of Quake were implemented. They reacted really cool
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
Humm.. Perhaps parenting the camera (player) to the elevator in a "trigger" zone then releasing the parenting when the player get out of the "trigger" zone.
Not sure they do it this way since the player would not be able to move/jump while the elevator is moving.
Another idea would be to check for every node on the platform(trigger zone), and when moving (up/down) those nodes would move with the same increments as the platform (fake parenting). Then there refresh the collisions (after moving the nodes). I think this would allow the player to have the same freedom while the platform is moving and would allow to have physic crates or other things on the platform.
Not sure they do it this way since the player would not be able to move/jump while the elevator is moving.
Another idea would be to check for every node on the platform(trigger zone), and when moving (up/down) those nodes would move with the same increments as the platform (fake parenting). Then there refresh the collisions (after moving the nodes). I think this would allow the player to have the same freedom while the platform is moving and would allow to have physic crates or other things on the platform.