Repository navigation
|
I have a bunch of different, but connected tiles for my world/terrain. Each one has their own (0, 0) origin (I wouldn't want to get far enough for floating point weirdness) and now when the player crosses over, I have to move each object one tile over. What is the best way of doing this? Do I just lock the whole physics system and transform each object (maybe even multithreaded carefully only touching each object from one thread)? EDIT: apparently called in other issues origin shifting and not the way Jolt likes to work, but in my case still the only possible way. Still, the other questions remain |
Replies: 1 comment 1 reply
|
I would recommend against origin shifting. You can compile Jolt with cmake option With Jolt, shifting the world is definitively possible, but to do it efficiently you'd need to modify Jolt a bit and add a call that will iterate all bodies, update their positions/aabbs and shift all broadphase aabbs. To do it not so efficiently, but with the existing API, would be to iterate over all bodies and call |
I would recommend against origin shifting. You can compile Jolt with cmake option
DOUBLE_PRECISION/ C++ defineJPH_DOUBLE_PRECISIONand then all positions will be tracked in doubles (comes at a very low cost). Unless you plan to make a world that's bigger than say earth, you should not run into issues. I don't know what your engines other limitations are, but it is not super complex to avoid float issues by tracking positions in doubles and then dropping down to float once you work in e.g. camera space. Shifting the origin is usually a costly operation and can cause frame hiccups.With Jolt, shifting the world is definitively possible, but to do it efficiently you'd need to modify Jolt a…