Team Spartan Cookies & Milk Forums
Reliably getting an entity's velocity clientside. - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: Reliably getting an entity's velocity clientside. (/thread-3816.html)



Reliably getting an entity's velocity clientside. - The17thDoctor - 06-04-2026

So I've been working on a starfall that requires getting an arbitrary entity's velocity no matter how this entity is being moved (whether through "natural" physics movements, drive core, parenting, etc..)

I've tried using the PhysObj:getVelocity() method, however this does not work when the entity is being moved by a drive core for instance.
I then tried to keep the last position of the entity and compare it to the current, however this produced artifacts when I tried doing that. I have theories on why but it's irrelevant to the problem.

I'm really struggling to find a way to reliably get velocity without artifacts of sorts. Is there any way that exists or that could be implemented ?


RE: Reliably getting an entity's velocity clientside. - Person8880 - 06-04-2026

An entity with a parent has no velocity by design, as far as the engine is concerned only the parent is actually moving. Any child entities will have exactly the same velocity, otherwise they wouldn't stay in the same relative position.

If you want the velocity of an entity that has a parent, you need to first resolve its root parent.


RE: Reliably getting an entity's velocity clientside. - The17thDoctor - 06-04-2026

The end goal is to be able to calculate the velocity of an entire contraption at specific points.
Given the information you provided, I believe I might be able to use the PhysObj:getVelocityAtPoint() to achieve what I want.


RE: Reliably getting an entity's velocity clientside. - The17thDoctor - 06-04-2026

Scrap that, sadly it seems that PhysObj are not always available clientside. Which my project needs.