Made a delta based animation system

Been working the past few hours on a little animation system to replace some of the older stuff I’ve been using for ages. A lot of that junk involved some sloppy constant looping stuff, and in some cases some funny angle bugs. I’m quite proud of this little monster.

The system allows for animations to be run over eachother, so a priority system allows some animations to show over others. Style defines the interpolation style of the animation, and the keyframes store a duration value, and the CFrames you want each involved joint to animate towards. The following is how keyframes are stored in table form in a module script required by the animation system.

[code]bank[“Demo”] = {
priority = 5,
style = “Sine”,

keyFrames = {
	[1] = {
		duration = 2,
		["Right Shoulder"] = CFrame.new(),
		["Neck"] = CFrame.new(),
	},
	[2] = {
		duration = 2,
		["Right Shoulder"] = CFrame.new(),
		["Neck"] = CFrame.new(),
	},
}

}[/code]

Calling builds a table of joints the system can use. It will search the suplied object for joints, it can also do a recursive search and pull any JointInstance bases hidden deeper in the supplied object.

animate:setJoints(character.Torso, true)

Returns a table of animations and the statues they have

  • Jumping Animation = running
  • Shooting Animation = running
  • Throw Animation = dead
animate:getStates()

Would stop the animation “Demo Animation”

animate:stop("Demo Animation")

Would play animation “Demo Animation”, no time mods, no looping, no smooth start, no call back, just a plane and simple animation call.

animate:play("Demo Animation")

Would play animation “Testing Animation” at a speed mod of 1, no looping, smoothing into the first frame, and contain a callback that will allow the yielding of the animation 90% of the way into the animations cycle and add onto some of the base cframes for the animation frames

[code]animate:play(“Demo Animation”, 1, false, true, function(currentFrame, totalFrames)
local percentage = currentFrame/totalFrames
local earlyKill = percentage > 0.9

local baseOffsets = {
	["Neck"] = CFrame.new(0, 1, 0),
	["Gun Weld"] = CFrame.Angles(0, 0, percentage * math.pi/4),
}

return baseOffsets, earlyKill and "kill"

end)[/code]

Wes is currently implementing it into our new build of Ignoble, after which we’ll be setting up some animations and hopefully ship out a demo for everyone to try in the coming days.