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 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 |
// ============================================================================ // JBCamControllerArena // Copyright 2004 by Mychaeel <mychaeel@planetjailbreak.com> // $Id: JBCamControllerArena.uc,v 1.6 2005-04-24 17:46:19 mychaeel Exp $ // // Camera trailing a given player and focusing on another player when that // player is visible. // ============================================================================ class JBCamControllerArena extends JBCamController noteditinlinenew; // ============================================================================ // Variables // ============================================================================ var private float Distance; // current following distance var private float DistanceMax; // maximum following distance var private vector Offset; // offset from followed player var private vector LocationPawnFollowed; // location of followed pawn in arena var private vector LocationPawnOpponent; // location of opponent pawn in arena var private float TimeTrack; // time to track invisible opponent var private bool bHasSeenFollowed; // followed pawn has been seen var private bool bHasSeenOpponent; // opponent pawn has been seen // ============================================================================ // UpdateMovement // // Keeps the camera behind the player and tracks the other player. // ============================================================================ function UpdateMovement(float TimeDelta) { local float Alpha; local rotator Rotation; local vector Location; local vector LocationTraceHit; local vector LocationTraceEnd; local vector VectorRotation; local vector VectorNormal; local Pawn PawnPlayerFollowed; local Pawn PawnPlayerOpponent; local JBCameraArena CameraArena; CameraArena = JBCameraArena(Camera); if (CameraArena == None) return; Alpha = FMin(1.0, TimeDelta * 3.0); if (CameraArena.TagPlayerFollowed != None && CameraArena.TagPlayerFollowed.IsInArena()) PawnPlayerFollowed = CameraArena.TagPlayerFollowed.GetPawn(); if (CameraArena.TagPlayerOpponent != None && CameraArena.TagPlayerOpponent.IsInArena()) PawnPlayerOpponent = CameraArena.TagPlayerOpponent.GetPawn(); if (!bHasSeenFollowed) TimeDelta = 0.0; if (PawnPlayerFollowed != None) bHasSeenFollowed = True; if (PawnPlayerOpponent != None) bHasSeenOpponent = True; if (PawnPlayerFollowed != None) { if (TimeDelta == 0.0) LocationPawnFollowed = PawnPlayerFollowed.Location; else LocationPawnFollowed += (PawnPlayerFollowed.Location - LocationPawnFollowed) * Alpha; if (Vehicle(PawnPlayerFollowed) != None) { DistanceMax = Vehicle(PawnPlayerFollowed).Default.TPCamDistance; Offset = Vehicle(PawnPlayerFollowed).Default.TPCamWorldOffset; } else { DistanceMax = Default.DistanceMax; Offset = Default.Offset; } } if (PawnPlayerOpponent != None) if (TimeDelta == 0.0) LocationPawnOpponent = PawnPlayerOpponent.Location; else LocationPawnOpponent += (PawnPlayerOpponent.Location - LocationPawnOpponent) * Alpha; if (TimeDelta == 0.0) Distance = DistanceMax; else Distance += (DistanceMax - Distance) * Alpha; if (bHasSeenFollowed && bHasSeenOpponent) if (Camera.FastTrace(LocationPawnFollowed, LocationPawnOpponent)) TimeTrack = 3.0; else TimeTrack = FMax(0.0, TimeTrack - TimeDelta); if (TimeTrack > 0.0) Rotation = rotator(LocationPawnOpponent - LocationPawnFollowed); else if (PawnPlayerFollowed == None) Rotation = Camera.Rotation; else { VectorRotation = vector(PawnPlayerFollowed.Rotation); VectorRotation.Z = 0; Rotation = rotator(VectorRotation); } if (TimeDelta > 0.0) Rotation = Camera.Rotation + Normalize(Rotation - Camera.Rotation) * Alpha; Rotation.Roll = 0; Location = LocationPawnFollowed + Offset; VectorRotation = vect(1,0,0) >> Rotation; LocationTraceEnd = Location - (Distance + 30.0) * vector(Rotation); if (Camera.Trace(LocationTraceHit, VectorNormal, LocationTraceEnd, Location) != None) Distance = FMin(Distance, (Location - LocationTraceHit) dot VectorRotation); Location -= (Distance - 30.0) * VectorRotation; Camera.SetRotation(Rotation); Camera.SetLocation(Location); } // ============================================================================ // Defaults // ============================================================================ defaultproperties { DistanceMax = 240.0; Offset = (Z=60.0); } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |