How to change the velocity of an entity #1949
-
I can't manage to figure it out, |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
-
Are you changing it on the server? |
Beta Was this translation helpful? Give feedback.
-
The server is what holds the real data and does stuff. |
Beta Was this translation helpful? Give feedback.
-
This code snippet doesn't explain where it is being called/used. If you want to modify game state from the client then you need to send a custom network message to the server. As to the details, have a look at something like One thing I notice in your code is that you setVelocity() which does not modify Entity.velocityDirty while addVelocity() does. |
Beta Was this translation helpful? Give feedback.
-
I see you mentioned earlier where the code is used. |
Beta Was this translation helpful? Give feedback.
-
Thanks SO MUCH to @warjort. The solution is actually very obvious, I don't know how did I miss this... I got the entities from |
Beta Was this translation helpful? Give feedback.
Thanks SO MUCH to @warjort. The solution is actually very obvious, I don't know how did I miss this...
I got the entities from
ClientWorld
(meaning I could only read their data not write it), while I should've got them fromServerWorld
(where I can actually write it).