ZylonBane on 11/2/2020 at 23:43
Err, my experience with the PhysState fields is that they should be treated as read-only, since they tend to revert any changes after a return from game mode. And yes, scripts should stick to using Teleport() instead of monkeying around with the physics internals.
PinkDot on 12/2/2020 at 08:43
Thanks for the info. My question was purely UI related - not scripts, but still - good to know.
FireMage on 12/2/2020 at 15:35
Quote Posted by ZylonBane
Err, my experience with the PhysState fields is that they should be treated as read-only, since they tend to revert any changes after a return from game mode.
Actually, PhysState behave a bit like an anchor with movements. If you are modifying velocity once, those should not be touched but if you're doing a script which loops to edit this velocity (for a head tracking projectile for example) so it rotate or accelerate constantly until it reaches its target, you'll have a glitch with the velocity : the object will move via the velocity but will teleport suddenly at a random location which is actually the position it should have reached if you didn't had edited the velocity. Such glitch don't happen if you use Physics.SetVelocity instead of Property.Set(obj,"PhysState","Velocity") tho so you'll obviously tell me such piece of news is worthless but still interesting to know how DarkEngine's physics works.
So the way to prevent this awful glitch is to set PhysState position and rotation to the current position of the object so no matter where the object will be sent by the new velocity, it will be the right location for the engine.
But well, that's complex scripting and it's being a bit off-topic so I won't go further in here.