Handling movement on an entity

Creating a flying drone and needing a bit of help with how to handle/pass movement to it. I’m of course going to be freezing the player in place but not sure how to capture key presses and passing them to the ent. :o

Any help will be greatly appreciated. :>

EDIT: May have actually came up with something that should work. Use KeyPress hook to listen for forward movement, set velocity. On KeyRelease for forward movement, set velocity back to normal.
EDIT2: Do I need to set velocity for both the Entity and PhysObj of the entity? Getting some really weird results from setting velocity on one or both. Cannot be grabbed by physgun or shot after velocity.

StartMove, Move, and FinishMove hooks respectively, they do everything you’re asking for without messing around with KeyPress or any of that. Look at drive_base.lua on the github for gmod: https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/drive/drive_base.lua
They’re also efficient and predicted

So it will allow me to do everything I’m needing? Such as pitch/yaw, not having a headache with velocities, along with being able to have some “hovering” involved eh?

Yep.

Hmm what about not having no-clip enabled for the entity being driven? I assume I’m most likely going to have to modify drive to not set positions if the prop is going to go into something, right?

I have ENT:PhysicsSimulate() going pretty well minus the fact that when you set angles on the entity during then, it apparently doesn’t like it and causes the entities velocity to drop. Not really sure why.