Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Engine.AnimNotify_ViewShake


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
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
/**
 * Copyright 1998-2007 Epic Games, Inc. All Rights Reserved.
 */
class AnimNotify_ViewShake extends AnimNotify_Scripted;

/** radius within which to shake player views */
var()   float   ShakeRadius;
/** Duration in seconds of shake */
var()   float   Duration;
/** view rotation amplitude (pitch,yaw,roll) */
var()   vector  RotAmplitude;
/** frequency of rotation shake */
var()   vector  RotFrequency;
/** relative view offset amplitude (x,y,z) */
var()   vector  LocAmplitude;
/** frequency of view offset shake */
var()   vector  LocFrequency;
/** fov shake amplitude */
var()   float   FOVAmplitude;
/** fov shake frequency */
var()   float   FOVFrequency;

/** Should use a bone location as shake's epicentre? */
var()   bool    bUseBoneLocation;
/** if so, bone name to use */
var()   name    BoneName;

event Notify( Actor Owner, AnimNodeSequence AnimSeqInstigator )
{
    local PlayerController PC;
    local float         Pct, DistToOrigin;
    local vector        ViewShakeOrigin, CamLoc;
    local rotator       CamRot;

    // Figure out world origin of view shake
    if( bUseBoneLocation &&
        AnimSeqInstigator != None &&
        AnimSeqInstigator.SkelComponent != None )
    {
        ViewShakeOrigin = AnimSeqInstigator.SkelComponent.GetBoneLocation( BoneName );
    }
    else
    {
        ViewShakeOrigin = Owner.Location;
    }

    // propagate to all player controllers
    if (Owner != None)
    {
        foreach Owner.WorldInfo.AllControllers(class'PlayerController', PC)
        {
            PC.GetPlayerViewPoint(CamLoc, CamRot);
            DistToOrigin = VSize(ViewShakeOrigin - CamLoc);
            if( DistToOrigin < ShakeRadius )
            {
                Pct = 1.f - (DistToOrigin / ShakeRadius);
                PC.CameraShake
                (
                    Duration*Pct,
                    RotAmplitude*Pct,
                    RotFrequency*Pct,
                    LocAmplitude*Pct,
                    LocFrequency*Pct,
                    FOVAmplitude*Pct,
                    FOVFrequency*Pct
                );
            }
        }
    }
}

defaultproperties
{
   ShakeRadius=4096.000000
   Duration=1.000000
   RotAmplitude=(X=100.000000,Y=100.000000,Z=200.000000)
   RotFrequency=(X=10.000000,Y=10.000000,Z=25.000000)
   LocAmplitude=(X=0.000000,Y=3.000000,Z=6.000000)
   LocFrequency=(X=1.000000,Y=10.000000,Z=20.000000)
   FOVAmplitude=2.000000
   FOVFrequency=5.000000
   Name="Default__AnimNotify_ViewShake"
   ObjectArchetype=AnimNotify_Scripted'Engine.Default__AnimNotify_Scripted'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Thu 22/11/2007 16:04:44.000 - Creation time: Mon 26/11/2007 17:41:47.375 - Created with UnCodeX