after speaking with Luke, I implemented the prototype of CameraVolume.
What is CameraVolume?
When a playerController enters the volume, his Point Of View switches to CameraVolume Point Of View. The cameravolume is linked to a cameraActor which become CameraVolume's Point of View.
2 ways to set the CameraActor:
- add a CameraActor in the Map set cameratag field and set the same tagname in CameraVolume properties
- set relative position and rotation to a camera which will spawned when game start
2 CameraActors are currently available
- fixedCameraActor: fixed location and rotation
- rotateCameraActor: fixed location rotation (face the PlayerOwner)
Here is a video of the rotate camera: Rotate Camera
CameraVolume
class DataRun_CameraVolume extends PhysicsVolume
placeable;
var DataRun_FixedCameraActor cameraActor;
enum CameraActorType
{
TYPE_FIXED, TYPE_ROTATE
};
enum CameraType
{
TYPE_EXTERNAL_CAMERA, TYPE_MANUAL_CAMERA
};
var() CameraType camType;
var(ExistingCamera) string cameraTag;
var(OwnCamera) CameraActorType camActorType;
var(OwnCamera) vector cameraRelativePosition;
var(OwnCamera) rotator cameraRelativeRotation;
simulated function PostBeginPlay()
{
local box ActorBox;
local DataRun_FixedCameraActor a;
switch(camType)
{
case CameraType.TYPE_MANUAL_CAMERA:
cameraRelativePosition += location;
cameraRelativeRotation += rotation;
//GetComponentsBoundingBox(ActorBox);
switch(camActorType)
{
case CameraActorType.TYPE_FIXED:
cameraActor = Spawn(class'DataRun_FixedCameraActor', self,,,,, TRUE);
break;
case CameraActorType.TYPE_ROTATE:
cameraActor = Spawn(class'DataRun_RotateCameraActor', self,,,,, TRUE);
break;
}
cameraActor.SetLocation(cameraRelativePosition);
cameraActor.SetRotation(cameraRelativeRotation);
break;
case CameraType.TYPE_EXTERNAL_CAMERA:
foreach WorldInfo.AllActors(class'DataRun_FixedCameraActor', a)
{
if(a.cameraTag == cameraTag)
{
cameraActor = a;
break;
}
}
}
LogInternal("CameraActor: "$cameraActor);
}
event PawnEnteredVolume(Pawn Other)
{
if(PlayerController(Other.Controller) != None)
{
cameraActor.PC = UTPlayerController(Other.Controller);
UTPlayerController(Other.Controller).MatineeCameraClass = class'DataRun_FixedCamera';
UTPlayerController(Other.Controller).SpawnCamera();
UTPlayerController(Other.Controller).PlayerCamera.SetViewTarget(cameraActor);
}
}
event PawnLeavingVolume(Pawn Other)
{
if(PlayerController(Other.Controller) != None)
{
UTPlayerController(Other.Controller).MatineeCameraClass = none;
if(UTPlayerController(Other.Controller).PlayerCamera != None)
{
UTPlayerController(Other.Controller).PlayerCamera.SetViewTarget(Other);
UTPlayerController(Other.Controller).PlayerCamera.Destroy();
UTPlayerController(Other.Controller).PlayerCamera = none;
}
}
}
function Vector getVolumeCenter()
{
local box ActorBox;
local Vector diagonal;
GetComponentsBoundingBox(ActorBox);
diagonal = ActorBox.Max - ActorBox.Min;
return diagonal / 2;
}
defaultproperties
{
camType =TYPE_MANUAL_CAMERA
camActorType = TYPE_ROTATE
}FixedCameraActor
class DataRun_FixedCameraActor extends DynamicCameraActor
placeable;
var() string cameraTag;
var PlayerController PC;
simulated function GetCameraView(float DeltaTime, out TPOV OutPOV)
{
GetActorEyesViewPoint(OutPOV.Location, OutPOV.Rotation);
OutPOV.FOV = FOVAngle;
}
defaultproperties
{
cameraTag="DataRun_FixedCameraActor";
}RotateCameraActor
class DataRun_RotateCameraActor extends DataRun_FixedCameraActor
placeable;
simulated function GetCameraView(float DeltaTime, out TPOV OutPOV)
{
super.GetCameraView(DeltaTime, OutPOV);
if(PC == None)
return;
OutPOV.Rotation = rotator(PC.Pawn.Location-Location);
}
defaultproperties
{
cameraTag="DataRun_RotateCameraActor";
}Camera
class DataRun_FixedCamera extends Camera;
Comment ?








