wiremod / wire-extras

Community Contributed Wire Extras Repository (formerly UWSVN). These are addons which may be of use to wiremodders but do not undergo the same level of critique that the official repos do.
Apache License 2.0
83 stars 67 forks source link

HoloAnim on TF2 sentry #29

Open adosikas opened 9 years ago

adosikas commented 9 years ago

Enabling the fire animation not only flips the holo by 90 degrees, but also resets the facing set by holoSetPose, which makes it basicly pointless to use.

holoCreate(1,entity():pos(),vec(1,1,1),ang())
holoModel(1,"models/buildables/sentry3.mdl")
holoAnim(1,"fire")

(This affects all 3 levels of the sentry, but not all animations) Is this something that can be fixed here, or is it how the model gets read by GMod? In TF2 it obviously works.

thegrb93 commented 5 years ago

Probably something in the holoAnim function causing it.

thegrb93 commented 5 years ago

One of these functions perhaps. https://github.com/wiremod/wire-extras/blob/master/lua/entities/gmod_wire_expression2/core/custom/holoanim.lua#L27

thegrb93 commented 5 years ago

To properly work, the gesture functionality must be used instead.

http://wiki.garrysmod.com/page/Entity/AddGestureSequence http://wiki.garrysmod.com/page/Entity/AddGesture http://wiki.garrysmod.com/page/Entity/RestartGesture

Deboggle commented 2 years ago

Been working on this very briefly, but it seems that even with using AddGesture/AddGestureSequence poses still don't work as the gesture still overrides them. I'm really not experienced much in GLua so I don't know if there's something that I've missed, but I get the nasty feeling that this is a limitation within Garry's Mod and the way it handles animations and poses rather than just using Gestures instead of Sequences. Using AddGesture instead of ResetSequence yields the same results; the animation overrides the poses, regardless if the pose is set before, during or after the animation has played.

For reference, I modified lines 37-40 in the holoanim.lua as shown:

local gesture = Holo.ent:AddLayeredSequence(Animation, 1)
Holo.ent:SetLayerCycle(gesture, math.Clamp(Frame,0,1))
Holo.ent:SetLayerPlaybackRate(gesture, math.Clamp(Rate,0,12)) 

@thegrb93 You seem to be very knowledgeable in GLua - any ideas?

thegrb93 commented 2 years ago

There's a glua addon for Tf2 turrets that I read the code from. I'd suggest looking at that to see how it's done.

Deboggle commented 2 years ago

I can't seem to find anything like that addon you mentioned despite a fair amount of digging - most addons I can find are just based off a generic standing turret NPC base and just have a remodel or visual change or whatever.

I had a quick look at Valve's own turret code, and whilst that is in CPP, the basic functionality is that it uses SetActivity which handles all the animations and sequences for the base turret NPC, a function which naturally is only callable on NPCs, though internally it should use the same functions for playing sequences so I don't see how it shouldn't work the same