-
Hi first of all, thank you for your work! I've been trying Jolt Physics here and there and I'm facing a problem, although is more of a general question. It is related to my ignorance using physics engines as I'm fairly inexperience in 3D but im curious... Right now I'm running a simulation on the entities of my world and after every physics update I go, look into a Note: I'm not using any ECS nor inheritance on my game logic. So my question is: How does people normally handle this synchronization between the new transform of the body after the physics simulation and the update to the actual graphical representation of the physics body. If I had some ECS then using a phsyics component I could query this component for the entities that have them, but this is not the case, at least for know. (Also, is there a Discord server?) Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I would suggest to use class GameObjectInterface
{
virtual void SetWorldTransform(...) = 0;
}
class Entity : public GameObjectInterface
{
virtual void SetWorldTransform(...) override { ... }
}
class NotAnEntity : public GameObjectInterface
{
virtual void SetWorldTransform(...) override { ... }
} If that's not possible then at least the lower 3 bits of any pointer will be zero (allocations are usually 8 byte aligned on 32-bit platforms, 16 byte aligned on 64-bit platforms), so you could use those bits to store the type of object that you're pointing at. After
No there isn't. I think github discussions keep stuff better organized and searchable. |
Beta Was this translation helpful? Give feedback.
I would suggest to use
Body::Get/SetUserData
. You can store a 64-bit number, so that's plenty for a pointer to anEntity
or perhaps something like:If that's not possible then at least the lower 3 bits of any pointer will be zero (allocations are usually 8 byte aligned on 32-bit platforms, 16 byte aligned on 64-bit platforms), so you could use those bits to store the type of object that you're pointing at.
A…