Hey guys,
I am sitting on a little jump and run platformer, wich will have, well platforms and holes. It would be nice, if the holes could be dynamic, I mean that I could create at same some point of time, for example if the player reach a specific level, add more holes or somethink similar.
This would be in 3d. What do you think, is this reachable with bepuphysic? First I had thought about triangle mesh, but I found no way to change it after cration.
I hope you know what I mean.
all the best,
Chriss.
Collidable type of floor (dynamic holes and with platforms)
Re: Collidable type of floor (dynamic holes and with platforms)
Some options, not mutually exclusive:
1) Use multiple colliders. For areas where you might want to put a hole, use a separate collider that you can simply remove.
2) Use a triangle mesh. When you want to change it, just create a new triangle mesh, remove the old one, add the new one.
3) Use a triangle mesh and modify it. This is a little trickier than just creating a new one since you need to be aware of how the mesh works. For small scale triangle movement or deformation, you could get away with just refitting the mesh's Tree after the modifications. For topological changes (add/remove triangles), you'll need to add/remove entries in the tree. For big changes (movement or topological), you'll likely want to refine or rebuild the tree. Refitting or refinement tends to be much, much faster than rebuilding, but if you don't need the performance, just creating a new mesh and replacing the old one is easier developmentally.
1) Use multiple colliders. For areas where you might want to put a hole, use a separate collider that you can simply remove.
2) Use a triangle mesh. When you want to change it, just create a new triangle mesh, remove the old one, add the new one.
3) Use a triangle mesh and modify it. This is a little trickier than just creating a new one since you need to be aware of how the mesh works. For small scale triangle movement or deformation, you could get away with just refitting the mesh's Tree after the modifications. For topological changes (add/remove triangles), you'll need to add/remove entries in the tree. For big changes (movement or topological), you'll likely want to refine or rebuild the tree. Refitting or refinement tends to be much, much faster than rebuilding, but if you don't need the performance, just creating a new mesh and replacing the old one is easier developmentally.
Re: Collidable type of floor (dynamic holes and with platforms)
Hey,
thank you for the quick answer.
1. is not the right way for me I think, because I don't won't to limit the areas, where a hole can spawn.
2. well, simpel but, if there are objects on there, there will fall, if the mesh is removed right? I don't know how fast the mesh is recreated, but maybe this could be result in strange behaviours.
3 looks like the best but the complexest way. Do you could give my a point, where to start exactly? Maybe pseudo-code or the method in three to remove and add triangles? What do you mean with the scale?
thank you for the quick answer.
1. is not the right way for me I think, because I don't won't to limit the areas, where a hole can spawn.
2. well, simpel but, if there are objects on there, there will fall, if the mesh is removed right? I don't know how fast the mesh is recreated, but maybe this could be result in strange behaviours.
3 looks like the best but the complexest way. Do you could give my a point, where to start exactly? Maybe pseudo-code or the method in three to remove and add triangles? What do you mean with the scale?
Re: Collidable type of floor (dynamic holes and with platforms)
The new mesh should be added before the simulation continues to run. From the perspective of the simulation, there was never a gap. If it turns out that building the new mesh takes long enough that there's an unacceptable frame hitch and you don't want to use a loading screen or similar, the new mesh can be built on another thread, and the mesh can be instantly swapped out once it's ready.2. well, simpel but, if there are objects on there, there will fall, if the mesh is removed right? I don't know how fast the mesh is recreated, but maybe this could be result in strange behaviours.
I'd recommend first checking to see if the simpler approach would work.looks like the best but the complexest way. Do you could give my a point, where to start exactly? Maybe pseudo-code or the method in three to remove and add triangles? What do you mean with the scale?