Hi 2 ALL.
so i have coded a third person cam using mougli's tutorials , but i want to limit rotation of the camera. it goes like this :
the player must have rotation boundaries so must the cam , they cant rotate their aim until a certain point . but i cant figure out how to pull this off on either of them ( the pawn & the camera ).
so figured i'l ask here .
Codes :
cam class
third person camCode:class AcCamClass extends GamePlayerCamera; protected function GameCameraBase FindBestCameraType(Actor CameraTarget) { return ThirdPersonCam; } DefaultProperties { ThirdPersonCameraClass=class'Bob.AcThirdPersonCam' }
there's nothing special about the pawn so i didnt post it here but feel free to ask.Code:class AcThirdPersonCam extends GameCameraBase; var float ThirdPersonCamOffsetX; var float ThirdPersonCamOffsetY; var float ThirdPersonCamOffsetZ; var Rotator CurrentCamOrientation; var Rotator DesiredCamOrientation; var CenterObj CObj; var Vector CPos; simulated function PostBeginPlay() { Super.PostBeginPlay(); foreach AllActors(class'Bob.CenterObj',CObj) { CPos = CObj.Location; } } function UpdateCamera(Pawn P, GamePlayerCamera CameraActor, float DeltaTime, out TViewTarget OutVT) { local float Radius, Height; local vector X,Y,Z; P.GetAxes(DesiredCamOrientation,X,Y,Z); // We will be working with coordinates in pawn space, but rotated according to the Desired Rotation. P.GetBoundingCylinder(Radius, Height); //Get the pawn's height as a base for the Z offset. OutVT.POV.Location = P.Location + ThirdPersonCamOffsetX * X + ThirdPersonCamOffsetY * Y + (Height+ThirdPersonCamOffsetZ) * Z; if (DesiredCamOrientation != CurrentCamOrientation) { CurrentCamOrientation = RInterpTo(CurrentCamOrientation,DesiredCamOrientation,DeltaTime,10); } OutVT.POV.Rotation = CurrentCamOrientation; } function ProcessViewRotation( float DeltaTime, Actor ViewTarget, out Rotator out_ViewRotation, out Rotator out_DeltaRot ) { DesiredCamOrientation = out_ViewRotation + out_DeltaRot; } DefaultProperties { ThirdPersonCamOffsetX=-80.0 ThirdPersonCamOffsetY=8.0 ThirdPersonCamOffsetZ=-32.0 }



Reply With Quote




Bookmarks