Skeletal Mesh
Skeletal Animation is essentially new in UT2003. Some support was implemented in the final builds of the Unreal Tournament Generation of engines, but was not fully supported. It allows a player to be animated by specifying the movement of their bone?s, while the 'skin' twists and deforms automatically. This has the advantage of allowing some combination of animations. Combination of animations is used only sparingly in UT2003. In the behindview you can see that your torso barely moves when you run, but in the animation browser, the animation dictates that the weapon be pointed to the side while running. The idle animation is set to override the running animation on the spine and above. Thus the bones above the spine always play the idle animation even when the lower portions are running. This is an example of animation blending in UT2003. Skeletal animation is also integrated into the Karma Ragdoll system, so is important for that reason. They are defined in actor, and are accessible from any Actor that uses DrawType = DT_Mesh.
Skeletal Mesh Functions
All these functions are declared in the Actor class:
- LinkSkelAnim (MeshAnimation Anim, optional mesh NewMesh) [simulated native final]
- Sets the skeletal animation settings for this actor. If you supply a mesh argument, the mesh will also be changed.
- LinkMesh (mesh NewMesh, optional bool bKeepAnim) [simulated native final]
- Similar to LinkSkelAnim, this only links the mesh. The optional variable specifies whether the current skeletal animation settings should be retained. If it is true, the skeletal animation settings will remain unchanged. If it is false, the skeletal animation settings will be set to none, or to the defaults included in the mesh, if applicable.
- BoneRefresh ( ) [native final]
- I'm not exactly sure what this does, but I suspect it is called after making any significant change to the skeletal animation settings in order to refresh those changes natively. Or something.
- AnimBlendParams (int Stage, optional float BlendAlpha, optional float InTime, optional float OutTime, optional name BoneName, optional bool bGlobalPose) [native final]
- This sets the parameters for the animation blending. This is the amount that animations will be merged in the event that two conflicting animations play simulataneously on different channels. Stage is the channel that you want to set blending parameters for. InTime is the amount of time for which to interpolate in the blending. Thus, if Blendalpha is 0 and you set it to 1 with this function, using InTime of 1, it will wake 1 second before BlendAlpha is 1. At half a second it will be 0.5, etc. BlendAlpha is the amount to blend the animations. I believe that 0 is fully the channel with a lower number, 1 is fully the channel with the greater number, and 0.5 is half way (each animation applies half the motion to the bone that they would like to. Outtime is not implemented in the current build of the Unreal Engine. Bonename can be used to selectively set blending on certain bones. I do not know what bGlobalPost does.
- AnimBlendToAlpha (int Stage, float TargetAlpha, float TimeInterval) [native final]
- I believe that this is similar to AnimBlendParams, but with less parameters. It probrably executes faster too.
- coords GetBoneCoords (name BoneName) [native final]
- Returns the coordinates of a bone - This is the bone's built-in coordinate system. This could probrably be used to find the absolute rotation of a bone, using some vector maths.
- rotator GetBoneRotation (name BoneName, optional int Space) [native final]
- Returns the rotation of a bone. I believe that is it around the bone's coordinate system and is a combination of the animation rotation and any assigned rotation, but I am still unsure on this. I don't know what the second variable does.
- vector GetRootLocation ( ) [native final]
- Returns the location of the "root" of the skeleton. Likely relative to the world.
- rotator GetRootRotation ( ) [native final]
- Returns the rotation of the "root" of the skeleton. Relative to the world origin.
- vector GetRootLocationDelta ( ) [native final]
- ???
- rotator GetRootRotationDelta ( ) [native final]
- ???
- bool AttachToBone (Actor Attachment, name BoneName) [native final]
- Attaches an actor to the bone specified.
- bool DetachFromBone (Actor Attachment) [native final]
- Detaches the stated actor from any bone that it may be attached to.
- LockRootMotion (int Lock) [native final]
- ???
- SetBoneScale (int Slot, optional float BoneScale, optional name BoneName) [native final]
- Sets the "drawscale" of the bone, and of the "skin" that is considered attached to that bone. It will affect not only the bone you specified, but also all "child bones" of that bone. Slot is the "slot" that the scalar is stored in. To clear a "slot," you must call this function with just the slot and no parameters. Slots are not per-bone, they are per-actor. This is best illustrated with an example:
// This works. SetBoneScale (0, 2, 'Spine'); SetBoneScale (1, 2, 'Head'); SetBoneScale (2, 2, 'LFARM'); // Even though these are differen't slot/bone combinations, the slots 0, 1, and 2 are // overridden by the new bone and scalar information. SetBoneScale (1, 2, 'Spine'); SetBoneScale (2, 2, 'Head'); SetBoneScale (0, 2, 'LFARM'); // Clear the scalars by doing this. Calling SetBoneScale(0,0), etcetera would probrably // also work. SetBoneScale (0); SetBoneScale (1); SetBoneScale (2); // Scalars are cumulative if they are in different slots with the same bone name. // The spine is 6 times normal size in this example. SetBoneScale (0, 2, 'Spine'); SetBoneScale (1, 3, 'Spine'); // Fractional scalars are also possible. Here we negate slots 0 and 1 with a complementary // scalar. SetBoneScale(2, 0.15, 'Spine');
- SetBoneDirection (name BoneName, rotator BoneTurn, optional vector BoneTrans, optional float Alpha, optional int Space) [native final]
- Sets the rotation of a bone, relative to the world origin. (aka absolute)
- SetBoneRotation (name BoneName, optional rotator BoneTurn, optional int Space, optional float Alpha) [simulated native final]
- Sets a bone's rotation, relative to the rotation that the animation settings claim it "should" have. I'm not sure what the Space or Alpha parameters do.
- SetBoneLocation (name BoneName, optional vector BoneTrans, optional float Alpha) [native final]
- Sets the Location of a bone... I'm not sure what the arguments do, but since BoneTrans is a vector it's probrably the amount to move it by, or the place to put it, or someting.
- GetAnimParams (int Channel, out name OutSeqName, out float OutAnimFrame, out float OutAnimRate) [native final]
- ???
- bool AnimIsInGroup (int Channel, name GroupName) [native final]
- ???
- name GetClosestBone(vector loc, vector ray, out float boneDist, optional name BiasBone, optional float BiasDistance) [native final]
- Finds the bone closest to something. I believe that the location is the place to start the ray, then the ray specified the direction to trace, and the bone that comes closest to the trace is the winner. This is, however, purely speculation.
Related Topics
Foxpaw: I think that this page is a bit more informative than the previous one - many of the functions may need experimenting with to see what the parameters do, as I generally don't mess around with optional parameters unless I know what they do.