PDA

View Full Version : Third person code



TheAgent
11-13-2009, 10:47 PM
Whats the code to having a fully functional 3rd person camera that is better than the one in Hourences tutorial, i would appreciate the help thank you!

Solid Snake
11-13-2009, 10:50 PM
Better in what way?

TheAgent
11-13-2009, 10:53 PM
well just so that the target reticle wont be directly in the middle, like a over the shoulder cam a little closer to the right shoulder and what not, the cam here is a great start but its directly perfectly centered behind the character. which makes for awful aiming i just would like to know how to tweak it, im not much of a coder just artist

Solid Snake
11-13-2009, 11:07 PM
I see, well know that we know what you actually want, perhaps someone will be so kind to write the code.

TheAgent
11-13-2009, 11:16 PM
simulated function bool CalcCamera(float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV)
{
local vector start, end, hl, hn;
local actor a;

start = Location;

if (Controller != none)
{
end = Location - Vector(Controller.Rotation) * 192.f;
}
else
{
end = Location - Vector(Rotation) * 192.f;
}

a = Trace(hl, hn, end, start, false);

if (a != none)
{
out_CamLoc = hl;
}
else
{
out_CamLoc = end;
}

out_CamRot = Rotator(Location - out_CamLoc);
return true;
}


This is the code provided what can be added to make the camera closer to the right shoulder and also above it alittle at an angle?

Solid Snake
11-13-2009, 11:31 PM
Well, I've already helped since I wrote the above code. So it's someone else's turn now.

Angel_Mapper
11-13-2009, 11:33 PM
You have the Controller rotation there, that's all you really need to do whatever you want with the camera:
http://wiki.beyondunreal.com/Legacy:UnrealScript_Vector_Maths

TheAgent
11-13-2009, 11:40 PM
Thank you very much then , i wasnt sure how to use them

Valeranth
11-14-2009, 12:55 AM
Try SetCameraMode('ThirdPerson'); in the Controller...

fritzmonkey
11-14-2009, 02:23 AM
Well, I've already helped since I wrote the above code. So it's someone else's turn now.

Variable names, man.

TheAgent
11-14-2009, 01:38 PM
I still cant get the camera to where i want it to be

I change the values of

{
end = Location - Vector(Controller.Rotation) * 192.f;
}
else
{
end = Location - Vector(Rotation) * 192.f;


and it just moves the cam farther away and at an annoying angle wich makes the character look in a odd angle also

iniside
11-14-2009, 05:25 PM
That's one way of making camera. Another way is to overwrite Pawn.
Which works better it's hard to say. I have found that overwrting camera in Controller is harder to get work as I want.