Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TMCPawn extends MobilePawn; // or UDKPawn
- var vector ThirdPersonCamOffset1;
- var vector ThirdPersonCamOffset2;
- var vector ThirdPersonCamOffset3;
- var bool bInFirstPerson;
- //comes from the Actor Class,used to decide which type of camera we want.
- Simulated function bool CalcCamera(float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
- {
- local TMCPlayerController OIPC;
- OIPC= TMCPlayerController(Owner);
- out_FOV = 100.0;
- if(OIPC != None)
- {
- If(OIPC.ZoomCamPoint==0) //Handle BehindView
- {
- GetActorEyesViewPoint(out_CamLoc, out_CamRot); //get the actors view for first person
- }
- else
- {
- CalcThirdPersonCamera(fDeltaTime, out_CamLoc, out_CamRot, out_FOV, OIPC.ZoomCamPoint);
- }
- return true;
- }
- else
- {
- If(bInFirstPerson) //Handle BehindView
- {
- GetActorEyesViewPoint(out_CamLoc, out_CamRot); //get the actors view for first person
- RemoveMeshVisibility(true);
- }
- else
- {
- CalcThirdPersonCamera(fDeltaTime, out_CamLoc, out_CamRot, out_FOV);
- RemoveMeshVisibility(false);
- }
- return True;
- }
- }
- //function used to calculate the third person camera, uses same arguments as CalcCamera
- simulated function bool CalcThirdPersonCamera(float fDeltaTime, out
- vector out_CamLoc, out rotator out_CamRot, out float out_FOV, optional
- int CamZoom)
- {
- local vector CamLoc, HitLocation, HitNormal, CamX, CamY, CamZ;
- CamLoc = Location; //get Current Location of the Camera
- //gets the actual players rotation and puts it in to the players xyz axes
- GetAxes(out_CamRot, CamX, CamY, CamZ);//to get axes of the player based on
- //brings the current location of the camera based off Axis and Offset
- switch(CamZoom)
- {
- case 1:
- out_CamLoc = CamLoc - CamX*ThirdPersonCamOffset1.X +
- ThirdPersonCamOffset1.Y * CamY + ThirdPersonCamOffset1.Z * CamZ;
- break;
- case 2:
- out_CamLoc = CamLoc - CamX*ThirdPersonCamOffset2.X +
- ThirdPersonCamOffset2.Y * CamY + ThirdPersonCamOffset2.Z * CamZ;
- break;
- case 3:
- out_CamLoc = CamLoc - CamX*ThirdPersonCamOffset3.X +
- ThirdPersonCamOffset3.Y * CamY + ThirdPersonCamOffset3.Z * CamZ;
- break;
- default:
- Break;
- }
- //used to cause collission for camera
- if (Trace(HitLocation, HitNormal, out_CamLoc, CamLoc, false, vect(12,12,12)) != None)
- {
- //go to first person view if cornered
- GetActorEyesViewPoint( out_CamLoc, out_CamRot );
- RemoveMeshVisibility(true); //set mesh to invisible
- return false;
- }
- else if(Mesh.bOwnerNoSee==true) //if true lets turn it back off
- {
- Mesh.SetOwnerNoSee(false);
- }
- return true;
- }
- //used to remove or add the player mesh
- function RemoveMeshVisibility(bool Allow)
- {
- Mesh.SetOwnerNoSee(Allow);
- }
- defaultproperties
- {
- bInFirstPerson=false
- ThirdPersonCamOffset1=(X=-80.0,Y=8.0,Z=-32.0)
- ThirdPersonCamOffset2=(X=200.0,Y=8.0,Z=100.0)
- ThirdPersonCamOffset3=(X=-80.0,Y=-80.0,Z=-80.0)
- Begin Object class=SkeletalMeshComponent Name=MyPawnMesh
- SkeletalMesh=SkeletalMesh'MyPackage.soldier'
- //Scale3D=(X=0.8,Y=0.8,Z=0.8)
- //AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
- //AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
- HiddenGame=FALSE
- HiddenEditor=FALSE
- End Object
- Mesh=MyPawnMesh
- Components.Add(MyPawnMesh)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement