first I want to say that I’m reading this forum for many years and I’m very excited to see all the great projects. I have made the mistake to start to ‘big’ (minecraft clone) so there is not really any progress to show…
Also I want to thank the community for their help and the devs for their great work on this engine. All questions so far were answered with this forum…
I’m using the zay-es to implement a very basic physic engine.
I have read through all the docs and examples I found so far but I have still a conceptional question regarding zay-es.
For example. I have a system to set the new position of an object. Therefore I take the old position, the current velocity → add the new calculated delta and set it to the entity.
(p1 = p0 + v * dT)
If the entity does not move in the next frame (velocity is 0) it will be marked as changed because the position has changed.
EntitySet set = entityData.getEntities(Position.class, Velocity.class);
Do I have to use two EntitySet sets to ‘listen’ only to velocity updates?
I want to keep my systems small. So I have one to apply forces, one to calculate an velocity vector and one for positions and so on.
The position system for example needs the velocity and the current position to calculate the new position. After the calculation the system will update the position component of the entity. The position system should only ‘listen’ to velocity updates because nobody else will change the position.
But it will recognize the position change because the position component is in my entity set.
So it isn’t that the position hasn’t changed… it’s that you don’t care about the change because you already know it.
Basically, I would never do physics this way. (Most of the time, I don’t even have velocity as a component…)
But yeah, in your case you will have two entity sets I guess. One for objects with position (and whatever else makes them physical objects) and another one for velocities (and whatever else makes them physical objects).
I’m thinking they can’t just be position and velocity on their own… they must collide with something, etc… So it sounds like maybe you have a bunch of systems doing the job of one. Hard to tell from here.