this is my default properties for my third person cam
Code:
class xxxThirdPersonCameraMode_Default extends GameThirdPersonCameraMode_Default;
var float FOV;
function float GetDesiredFOV( Pawn ViewedPawn )
{
return FOV;
}
DefaultProperties
{
FOV=90.f;
TargetRelativeCameraOriginOffset=(x=-192,y=192,z=192)
bLockedToViewTarget=TRUE
bFollowTarget=FALSE
bInterpLocation=TRUE
bInterpRotation=TRUE
bSkipCameraCollision=TRUE
BlendTime=0.75
}
and my main class extends GameInfo with :
Code:
defaultproperties
{
bDelayedStart=false
PlayerControllerClass=class'xxx.xxxPlayerController'
DefaultPawnClass=class'xxx.MyPawn'
Name="Default__xxxGameInfo"
}
My pawn declaration is a mix of a class taken somewhere else :
Code:
class MyPawn extends GamePawn
config(Game);
simulated function name GetDefaultCameraMode( PlayerController RequestedBy )
{
`Log("xxx: Requested Third person camera Mode");
return 'ThirdPerson';
}
defaultproperties
{
Components.Remove(Sprite)
Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
ModShadowFadeoutTime=0.25
MinTimeBetweenFullUpdates=0.2
AmbientGlow=(R=.01,G=.01,B=.01,A=1)
AmbientShadowColor=(R=0.15,G=0.15,B=0.15)
LightShadowMode=LightShadow_ModulateBetter
ShadowFilterQuality=SFQ_High
bSynthesizeSHLight=TRUE
End Object
Components.Add(MyLightEnvironment)
Begin Object Class=SkeletalMeshComponent Name=InitialSkeletalMesh
CastShadow=true
bCastDynamicShadow=true
bOwnerNoSee=false
LightEnvironment=MyLightEnvironment;
BlockRigidBody=true;
CollideActors=true;
BlockZeroExtent=true;
PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_CH_Corrupt_Male_Physics'
AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_AimOffset'
AnimSets(1)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_CH_LIAM_Cathode'
End Object
Mesh=InitialSkeletalMesh;
Components.Add(InitialSkeletalMesh);
}
I got a basic extended camera :
Code:
class xxxPlayerCamera extends GamePlayerCamera;
protected function GameCameraBase FindBestCameraType(Actor CameraTarget)
{
return ThirdPersonCam;
}
defaultproperties
{
ThirdPersonCameraClass=class'xxx.xxxThirdPersonCamera'
}
With the declaration for third person :
Code:
class xxxThirdPersonCamera extends GameThirdPersonCamera;
DefaultProperties
{
ThirdPersonCamDefaultClass=class'xxx.xxxThirdPersonCameraMode_Default'
}
And at last the playerController :
Code:
class xxxPlayerController extends PlayerController
config(Game);
function UpdateRotation( float DeltaTime )
{
local Rotator ViewRotation;
ViewRotation.Pitch = (-45.0f * DegToRad) * RadToUnrRot;
ViewRotation.Yaw = (-45.0f * DegToRad) * RadToUnrRot;
SetRotation(ViewRotation);
}
defaultproperties
{
CameraClass=class'xxx.xxxPlayerCamera'
}
I will at some point check the values of the DegToRad and stuff and put a static value, so its a bit more optimized, but for the moment i like human readable stuff.
So it was only to basically do a SetRotation.
As rahatropa states, the mouse and point and click would help alot of people that are not interested in FPS's, I could take that time and try to get decent path finding in my game instead of doing this. In Unity it was quite simple, but in UDK once you know how, it is equivalent time-wise, but the learning curve is higher a bit.
Bookmarks