Results 1 to 15 of 15
  1. #1
    MSgt. Shooter Person
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    95

    Default Playing character animation

    I'm having a hard time trying to wrap my head around how the animation system works in Unreal Engine 3. I understand that you create "AnimTrees" and assign them to classes. These trees decide which animations are played and how they're morphed etc. I've been looking through the UnrealScript source like crazy, but it seems like everything but weapon animations are handled automagically by the engine using these AnimTrees.

    So.. If I want create a new custom animation and play it for a new situation - let's say a melee-animation when pressing a button - how exactly would I do that? The animation should play in first person view and for the pawn others are seeing. Obviously since there is no melee in Unreal, there's no node in the AnimTree editor for "melee pressed" or whatever. Isn't there a way to play and blend animations in UnrealScript?
    Last edited by Kenchu; 05-05-2012 at 01:13 PM.

  2. #2
    MSgt. Shooter Person
    Join Date
    Feb 2010
    Location
    ratsarmy.com
    Posts
    278

    Default

    As far as I know there is no AnimTree for Weapons, however it looks like you technically could get AnimTree's to work for Weapons, but I couldn't guarantee it would work and it would take a lot of work to accomplish. You're better off just calling the animations directly.

    For what you're asking, it depends on how you have your weapon coded, but in either case you would call the "PlayWeaponAnimation" which is provided by the parent Weapon class (Engine/Classes/Weapon.uc - line: 557). You can directly provide the skeletal mesh component you'd like to the play the animation if you need to.

    Actually playing it, such as the timing (and in your example the timing would be for when a player used a melee action), is up to you based on how you have your Weapons coded but it would generally be during the firing effects.

    Hope this helps.

    Edit: Forgot to mention that your Pawn would play it's own animations and can be played the same way as Weapons. The AnimTree, yet buggy, is extremely useful and preferred to play animations for the Pawn meshes. It handles directional movement, manipulating bones for aiming, and so on. There is something you should note though such as using animation node slots which enables you to play animations and only effect specified bones (or at least it climbs the hierarchy above the specified bones - Unreal Tournament has a great example for this) so that upper and lower body animations can play simultaneously. This is most likely what you want for your melee attack animation.
    Last edited by eternalcrisis; 05-05-2012 at 12:56 PM.

  3. #3
    MSgt. Shooter Person
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    95
    Last edited by Kenchu; 05-05-2012 at 03:45 PM.

  4. #4
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    218

    Default

    Weapon animtrees are possible on weapon attachments. It'll take some playing around with to get it working right but it does work

  5. #5

    Default

    Are there any tutorials out there that show Weapon Animtree's working? Not skeletal bone control like the UT_rocket_launcher, but actual animations like AnimSlotNode's or Blends of some sort? I keep getting access none errors when trying to call custom animations from the weapon attachments. The AnimTree never initializes. Any help would be awesome or links to some kind of tutorial for this. Thanks in advance!

  6. #6
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    218

    Default

    How are you linking the AnimTree? We can help you better if you show us some code.

  7. #7

    Default

    Sorry n00b here I should've put code initially. Below is my weapon attachment class where I am trying to initialize the animtree. A little back story on this I tried initializing in my Pawn class and calling the custom anim in my Weapon class, but because my FPS arms are declared as my mesh in the weapon class the animations from my tree weren't playing because the pawn mesh component is completely different. I was calling an animation that had a sound call on it and heard the sound, but didn't see the animation.

    So now I am trying to get the Anim Tree working with the weapon to call custom anims.

    class MyWeaponAttachment extends Actor
    dependson(MyPawn);

    /**********************
    Variables
    *********************/
    /** impact effects **/
    var array<MaterialImpactEffect> ImpactEffects;
    /** default impact effect **/
    var MaterialImpactEffect DefaultImpactEffect;

    var SkeletalMeshComponent Mesh;

    //--------------------------Anim Slot Node
    var AnimNodeSlot FullBodySlot;
    var AnimNodeSlot TopHalfSlot;
    var AnimNodeAdditiveBlending AdditiveForeGrip_Fire;


    /**********************
    Functions
    *********************/
    /** initiallzing animtree **/
    simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
    {
    `log("Getting into postInitAnim event BEFORE Mesh if check!!!!!!!!!!!!!!!!!!!!!!!");
    super.PostInitAnimTree(SkelComp);
    if(SkelComp == Mesh)
    {
    `log("Getting into postInitAnim event!!!!!!!!!!!!!!!!!!!!!!!");

    FullBodySlot = AnimNodeSlot(SkelComp.FindAnimNode('FullBodySlot') );
    TopHalfSlot = AnimNodeSlot(SkelComp.FindAnimNode('TopHalfSlot')) ;
    //AdditiveForeGrip_Fire = AnimNodeAdditiveBlending(SkelComp.FindAnimNode('Ad ditiveForeGrip_Fire'));
    }
    }

    //--------------------------------Play Custom Anims
    /** custom slot node animations **/
    simulated function PlaySlotAnim(name AnimationName, float AnimationSpeed)
    {
    FullBodySlot.PlayCustomAnim( AnimationName, AnimationSpeed, 0.0, 2.0, false, true);
    }

    DefaultProperties
    {
    DefaultImpactEffect=(DecalMaterials=(MaterialInsta nceConstant'Tutorial_Decal.Materials.Bullet_Decal2 _INST', MaterialInstanceConstant'Tutorial_Decal.Materials. Bullet_Decal3_INST', MaterialInstanceConstant'Tutorial_Decal.Materials. Bullet_Decal4_INST', MaterialInstanceConstant'Tutorial_Decal.Materials. Bullet_Decal5_INST', MaterialInstanceConstant'Tutorial_Decal.Materials. Bullet_Decal6_INST'),ParticleTemplate=ParticleSyst em'Tutorial_ImpactParticle.Particles.Pistol_Impact Particle',DurationOfDecal=4.000000,DecalDissolvePa ramName="DissolveAmount",DecalWidth=8.000000,Decal Height=8.000000)

    //anim sequence
    begin object class=AnimNodeSequence name=MeshSequenceA
    bCauseActorAnimEnd=true
    end object

    //arms mesh
    begin object class=UDKSkeletalMeshComponent name=ArmsMeshComp
    SkeletalMesh=SkeletalMesh'Ch_Vm_workGlove.Mesh.Ch_ Vm_workGlove'
    AnimSets(0)=AnimSet'Ch_Vm_workGlove.Anims.VM_Anims et_Rifle_HR'
    AnimTreeTemplate=AnimTree'Ch_Vm_workGlove.Tree.CH_ Vm_workGlove_Tree'
    DepthPriorityGroup=SDPG_Foreground
    bOnlyOwnerSee=true
    bOverrideAttachmentOwnerVisibility=true
    CastShadow=false
    FOV=65.0f
    Animations=MeshSequenceA
    bPerBoneMotionBlur=true
    bAcceptsStaticDecals=false
    bAcceptsDynamicDecals=false
    bUpdateSkelWhenNotRendered=false
    bComponentUseFixedSkelBounds=true
    end object
    Mesh=ArmsMeshComp
    }

    I am trying to call the animations from PlayFireEffect in my Weapon class here is that code...

    /** overloaded: play fire effects **/
    simulated function PlayFireEffects(byte FireModeNum, optional Vector HitLocation)
    {
    local MyWeapon W;

    W = MyWeapon(Owner);

    if(W != none)
    {
    if(WeaponAttachment != none)
    {

    if(ArmFireAnim != '')
    {
    //`log(Mesh.SkeletalMesh@MyPawn(Owner).Mesh.AnimSets[0]@MyPawn(Owner).Mesh.AnimTreeTemplate@MyPawn(Owner) .Mesh.bAttached);

    //PlayWeaponAnim(ArmFireAnim, ArmFireAnimRate, false);
    W.WeaponAttachment.PlaySlotAnim('Reload_1', 1.f);
    `log("played anim in code !!!!!! Or should have played anim in code what is stoping it from playing now !!!!!!!!");
    //MyPawn(Instigator).AdditiveForeGrip_Fire.SetBlendT arget(1, 0);

    if(ArmFireAnim == ArmAimFireAnim)
    {
    //PlayWeaponAnim(default.ArmFireAnim, ArmFireAnimRate, false, Firearm.Mesh);
    W.WeaponAttachment.PlaySlotAnim('Reload_1', 1.f);
    `log("played anim in code !!!!!! Or should have played anim in code what is stoping it from playing now !!!!!!!!");
    //MyPawn(Instigator).AdditiveForeGrip_Fire.SetBlendT arget(1, 0);
    }
    else
    {
    //PlayWeaponAnim(ArmFireAnim, ArmFireAnimRate, false, Firearm.Mesh);
    W.WeaponAttachment.PlaySlotAnim('Reload_1', 1.f);
    `log("played anim in code !!!!!! Or should have played anim in code what is stoping it from playing now !!!!!!!!");
    //MyPawn(Instigator).AdditiveForeGrip_Fire.SetBlendT arget(1, 0);
    }
    }
    }
    }
    else
    {
    `log("Weapon Attachment is 'NONE' !!!!!!!!!!!");
    }



    //play muzzle flash
    PlayMuzzleFlashEffect();

    //play fire sound
    //PlayWeaponSound(FireSound, 1.0);
    if(WeaponFireMode == 1)
    {
    PlayWeaponSound(BurstFireSound, 1.0);
    }
    if(WeaponFireMode == 2)
    {
    GotoState('WeaponFiring');
    }
    if(WeaponFireMode == 0)
    {
    PlayWeaponSound(FireSound, 1.0);
    }
    }

  8. #8
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    218

    Default

    Try setting Animations=MeshSequenceA to Animations=None instead.

  9. #9

    Default

    Nope didn't fix the issue... I'm thinking its some kind of casting issue from weapon "PlayFireEffect" to the weapon attachment class. I never see the animtree get initialized at all in the log. Thanks for taking a look though!

    Any idea's why the "PostInitAnimTree" function isn't being initialized in the weapon attachment class? Am I calling that wrong, or referencing a bad mesh or something?

  10. #10
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    218

    Default

    Ah I think I know.
    You have to add Components.Add(ArmsMeshComp) for the animtree to get initialized.

  11. #11

    Default

    Sweet! Now the AnimTree is getting initialized and the anim is playing, but it's on a completely different set of arms now. here is a screen shot...

    http://www.flickr.com/photos/78062934@N03/7154330512/

    Any ideas what might be causing an issue like this? The original "Arms" are called in the weapon class and that second floating set is from the weapon attachment Components.Add(ArmsMeshComp).
    Last edited by sidtone415; 05-07-2012 at 06:51 PM.

  12. #12
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    218

    Default

    If you're trying to get the animtree initialized on the first person arms you should be adding the animtree template to the arms in the Weapons class. Why are you making a separate pair of arms in the weapon attachment class?

  13. #13

    Default

    That's a good question, I was unsure how the weapon attachment class worked. If I have my animtree template declared in the weapon class ArmsMeshComp will the animtree get initialized from the weapon attachment class? I tried adding the "Components.Add(ArmsMeshComp)" to the mesh in my weapon class, but then the arms disappeared.

    Is their a was to associated the weapon class mesh to the weapon attachment so that the animtree from the weapon mesh will get initialized? I can post code or put a dropbox link up with the code if needed.

    Thanks for the hlep!

  14. #14
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    218

    Default

    It's probably most helpful if you post some code from your weapon class.
    You should also check out UTWeapon.uc to check out how they played their 1st person anims.

  15. #15

    Default

    I'm not having trouble playing animsequences only animnodes from the animtree it self. It doesn't want to initialize my arm's mesh animtree. I tried posting my code but it is way to much and would have taken up like 3 or 4 posts. so here is a link to my code through my public dropbox folder.

    http://dl.dropbox.com/u/39950987/MyUDKProject.zip


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.