Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 |
/** * when this node becomes relevant, it selects an animation from its list based on the rotation of * the given bone relative to the rotation of the owning actor * * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved. */ class UTAnimNodeSequenceByBoneRotation extends AnimNodeSequence; /** bone whose direction should be tested */ var() name BoneName; /** axis of that bone to check */ var() EAxis BoneAxis; /** list of animations to choose from */ struct AnimByRotation { /** desired rotation of the bone to play this animation */ var() rotator DesiredRotation; /** the animation to play */ var() name AnimName; }; var() array<AnimByRotation> AnimList; event OnBecomeRelevant() { local vector BoneDirection; local int i; local float Diff, BestDiff; local name BestAnim; if (SkelComponent.Owner == None) { WarnInternal("SkeletalMeshComponent has no Owner"); } else if (BoneAxis == AXIS_NONE || BoneAxis == AXIS_BLANK) { WarnInternal("Invalid Axis specified"); } else { // get the bone's rotation relative to the owning actor BoneDirection = SkelComponent.GetBoneAxis(BoneName, BoneAxis) >> SkelComponent.Owner.Rotation; // find the animation in the list whose rotation is closest to the bone's BestDiff = -1.0; for (i = 0; i < AnimList.length; i++) { Diff = BoneDirection Dot vector(AnimList[i].DesiredRotation); if (Diff > BestDiff) { BestAnim = AnimList[i].AnimName; BestDiff = Diff; } } // set to the best animation and make sure it starts from the beginning SetAnim(BestAnim); SetPosition(0.0f, false); } } defaultproperties { BoneAxis=AXIS_X Name="Default__UTAnimNodeSequenceByBoneRotation" ObjectArchetype=AnimNodeSequence'Engine.Default__AnimNodeSequence' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |