• Lua Animations API beta
    427 replies, posted
  • This is a script that allows you to create dynamic animations using only Lua. Two example stances are included. [b]It is obviously for coders. There is no use for the average gmod user.[/b] Use Entity(1):SetLuaAnimation("staffholdspell") or Entity(1):SetLuaAnimation("stancetest") and then turn third person mode on to see the examples. staffholdspell will only work correctly if you have a weapon out that uses the ACT_HL2MP_IDLE_MELEE[b]2[/b] group. [highlight]Download API + editor:[/highlight] [b]CURRENT (SVN):[/b] svn://noxiousnet.com/trunk/public/gmod13/animationsapi [b]CURRENT (DDL):[/b] [url]http://heavy.noxiousnet.com/boneanimlibv5.rar[/url] [highlight]Hooking up with your addon/gamemode/whatever[/highlight] include("boneanimlib.lua") in the server code. include("cl_boneanimlib.lua") in the client code. You are now ready to make calls to the API. It's suggested you put this stuff in its own folder. [highlight]Editor[/highlight] An editor is included. Type animate in the console to open it. I did not make the editor. [highlight]FrameData table structure[/highlight] float RU, float RR, float RF - Rotate up, rotate right, rotate forward. What you'll most likely be using for all animations. float MU, float MR, float MF - Move up, move right, move forward. Usually not used unless you really know what you're doing or want to make some wacky looking animations. [highlight]Animation table structure[/highlight] integer Type - The type of animation it is. Can be one of these: TYPE_GESTURE, TYPE_STANCE, TYPE_SEQUENCE, TYPE_POSTURE. See the script for more info on each. integer Interpolation - Can be one of these: INTERP_LINEAR, INTERP_COSINE, INTERP_CUBIC, INTERP_DEFAULT. Determines how the animation is smoothed between frames. Linear is no smoothing. Cosine is the best quality/compatibility balance. Cubic will smooth the best but your animation frames may overflow in to each other. table FrameData - See above and the examples inside the code. function PreCallback(pl, sGestureName, tGestureTable, iCurFrame, tFrameData, fFrameDelta) - Allows you to do work on the animation before being processed. Perform actions on tGestureTable. function ShouldPlay(pl, sGestureName, tGestureTable, iCurFrame, tFrameData, fFrameDelta, fPower) - If this exists and doesn't return true then the animation stops early. Awesome Strike: Source uses a few animations made with this system. [vid]http://heavy.noxiousnet.com/jetboom/de_dust2%202012-11-18%2020-25-53.webm[/vid]
  • By the way, stancetest is only testing the ability to move bones. In a normal custom animation you would only want to ROTATE the bones since the engine automatically handles offsetting from the parent bone and moving child bones.
  • Avatar of Daimao
  • Didn't the documentation explicitely say that BuildBonePositions wasn't meant for animations? :v:
  • Avatar of -TB-
  • Do you think this could be used to make npcs climb over a wall?
  • It could be used for anything you want, even having it so the animation can interact with the environment. Example, you could get the closest wall next to the npc and have their arm extend to it. It's really tedious without an editor.
  • Avatar of TehPeeMast3r
  • Wait wait.. How does this thing work.. Do you need to know how to code? boxes are accepted :sigh:
  • Avatar of CptFuzzies
  • Hey! You telepathically stole my idea! That's okay. One of my concept designs is an in-game equivalent of the SDK Faceposer. But no one's going to work on it, so I'm safe.
  • Avatar of CptFuzzies
  • Faceposer entails more than face posing. [editline]11:58PM[/editline] This: [url]http://developer.valvesoftware.com/wiki/Faceposer[/url] And if you think I wouldn't spend time doing it. You're wrong. Besides, everything looks better in Derma with my VGUI2 skin. Fantastic work on the animation API, by the way.
  • Avatar of LauIsFun
  • [QUOTE=CptFuzzies;17563596]Faceposer entails more than face posing. [editline]11:58PM[/editline] This: [url]http://developer.valvesoftware.com/wiki/Faceposer[/url] And if you think I wouldn't spend time doing it. You're wrong. Besides, everything looks better in Derma with my VGUI2 skin. Fantastic work on the animation API, by the way.[/QUOTE] Now I can masturbate in game too!
  • Avatar of Grea$eMonkey
  • Pretty cool, but for a lot of custom animations I'd think an actual editor would be better. But this could be very useful for small details in a game.
  • Avatar of TehPeeMast3r
  • [QUOTE=CptFuzzies;17563299]Hey! You telepathically stole my idea! That's okay. One of my concept designs is an in-game equivalent of the SDK Faceposer. But no one's going to work on it, so I'm safe.[/QUOTE] do it. do it.
  • Avatar of Python1320
  • [MEDIA]http://img225.imageshack.us/img225/7681/gmconstruct0005.jpg[/MEDIA] Give me that before you hurt someone with it.
  • Avatar of Salads
  • [QUOTE=Python1320;17571439][MEDIA]http://img225.imageshack.us/img225/7681/gmconstruct0005.jpg[/MEDIA] Give me that before you hurt someone with it.[/QUOTE] The position Kleiner's right arm is in looks painful.
  • Avatar of Bletotum
  • Win. I would imagine the noxiousnet developers might use this, for the ZS. I suppose an editor would save text files that can be called by this script?
  • [QUOTE=Bletotum;17575914]the noxiousnet developers[/quote]me? [QUOTE=Bletotum;17575914]I suppose an editor would save text files that can be called by this script?[/QUOTE]No, it would output plain text which you put in to a shared script.