Visual Vibrating Effect

How do you guys suggest I go about making a visual vibrating effect? I want it only to be visual. It won’t affect any entities movements.

I’m talking about changing how a specific entity looks, but thanks. I might use that.

There’s probably a way to visually change an entity’s position using the render library… but it’s too complicated for me to understand

I haven’t tried it myself, but maybe

Entity:SetRenderOrigin will do what you want. The description on the wiki is unclear and probably wrong so just test it in-game and see what it does.

I see what you’re saying. I can probably use this to set the players position a unit to the right and left every tick. Thanks.

Update the clients model of the entity.

You can do this by using SetRenderOrigin to its GetNetworkOrigin plus a random Vector inside the entity’s Draw function. SetRenderOrigin basically just changes where the model is drawn without moving it or changing collision or anything.

please don’t use SetRenderOrigin, it’s apparently terrible (according to jvs). Just use SetPos in a paint hook.

Won’t that just cause prediction errors?

I’ll try everything suggested! Thanks to you all!

[editline]30th November 2016[/editline]

Interesting! Thanks!

What exactly is a network origin? The position on the server?

Let me guess. The position on the client and server?

NetworkOrigin is the position the server is networking to clients. Basically the server-sided actual position.

No reason to use that instead of GetPos

Thanks everybody for the advice!

I wouldn’t do it every tick man. That might be too fast.

If it were me, I’d do it on Think (i.e. every frame on the client) and use a deterministic function based on CurTime to decide on the RenderOrigin offset from GetPos.

“Too fast” isn’t a factor if you Lerp it over a set time. Otherwise, setting a next change time would work.

[editline]3rd December 2016[/editline]

Think and Tick are both run every tick on the server and client. I believe DrawHUD might be the only hook called every client frame.


GM:Think and

ENT:Think run every frame, as the wiki mentions, with the exception of ENT:Think when NextThink is set. If my understanding is correct, this is how prediction works.

All render hooks (categorty, see subcategories for the majority) are also called every frame for rendering, including HUDPaint (which is what I assume you meant when you said DrawHUD).

Basically you’re hella wrong :wink:

Huh, I guess Source’s DoThink method has different call behaviour from the Lua binding clientside. Still has the same behaviour serverside it seems.