PDA

View Full Version : <3rd-Person Camera> & <Collision>



a_karimi
08-05-2010, 12:14 PM
Hi guys,
I'm working on a third person camera which shows player's mesh in the left side of the scene (rather than showing it in the middle of the scene). I have overridden my PlayerController's "getPlayerViewPoint" function like this:



simulated event getPlayerViewPoint (out vector out_Location, out Rotator out_rotation)
{
local vector x, y, z;
local vector cameraOffset;

super.getPlayerViewPoint(out_Location, out_rotation);

if (pawn != none)
{
getAxes(pawn.rotation, x, y, z);
cameraOffset = vect(-75, 40, 90);
out_location += cameraOffset.x * x + cameraOffset.y * y + cameraOffset.z * z;
}
}


The camera offsets as I want and I see the pawn's mesh in left side of the scene but there's a problem:
The CylinderComponent remains in the middle of the scene. So player can't go through doors when the mesh is in the middle of the door entrance (but when the center of the scene is in the middle of entrance the player passes the door)
The most strange thing is even when I shoot a bot's mesh, the trace passes through. I should shoot near the bot to make it take hit!

I have tried the same implementation with Pawn.calcCamera and Camera.updateCamera, and I got exactly the same result.

And I also set CollisionComponent=mesh in pawn.postBeginPlay() but it doesn't make any changes too (though the ragdoll works fine).

I got 2 Questions:
1. How to make a right 3rd person camera?
2. How to make the mesh's PhysicsAsset to be responsible for player's collision?

Thanks for your help in advance :)