Hey all
As I mentioned in my other question, I have been using some of the camera code found in the Eat3D DVD tutorial Master Class (The Assault Game) by James Tan. I have it all working, everything is great, I even managed to add an "aim" function (zoom in) using the right mouse button.
Now my next task is to remove (if possible) the extra motion that the camera inherits from being attached to the WeaponPoint socket in the pawn Mesh, Ironguard. I want the camera to be able to pitch and yaw (no roll) but it also inherits the motion of the mesh's animations such as idle, and running, etc.
Does anyone know if there is something in the UpdateViewTarget function that I can manipulate to remove the extras? Maybe I am stuck with it because the camera uses the socket as a parent?
This is my UpdateViewTarget function as it appears in my custom Camera class:
Thanks and any help would be much appreciated.Code:function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime) { local Pawn Pawn; local Vector V, PotentialCameraLocation, HitLocation, HitNormal; local Actor HitActor; if (CameraProperties == None) { Super.UpdateViewTarget(OutVT, DeltaTime); } // Don't update outgoing viewtarget during an interpolation if (PendingViewTarget.Target != None && OutVT == ViewTarget && BlendParams.bLockOutgoing) { return; } Pawn = Pawn(OutVT.Target); if (Pawn != None) { // If the camera properties have a valid pawn socket name, then start the camera location from there if (Pawn.Mesh != None && Pawn.Mesh.GetSocketByName(CameraProperties.PawnSocketName) != None) { Pawn.Mesh.GetSocketWorldLocationAndRotation(CameraProperties.PawnSocketName, OutVT.POV.Location, OutVT.POV.Rotation); } // Otherwise grab it from the target eye view point else { OutVT.Target.GetActorEyesViewPoint(OutVT.POV.Location, OutVT.POV.Rotation); } // If the camera properties forces the camera to always use the target rotation, then extract it now if (CameraProperties.UseTargetRotation) { OutVT.Target.GetActorEyesViewPoint(V, OutVT.POV.Rotation); } // Add the camera offset OutVT.POV.Rotation += CameraProperties.CameraRotationOffset; // Calculate the potential camera location PotentialCameraLocation = OutVT.POV.Location + (CameraProperties.CameraOffset >> OutVT.POV.Rotation); // Check to see if Aiming if (bAiming) { PotentialCameraLocation = OutVT.POV.Location + (CameraProperties.CameraOffset >> OutVT.POV.Rotation) / 1.5; } else { PotentialCameraLocation = OutVT.POV.Location + (CameraProperties.CameraOffset >> OutVT.POV.Rotation); } // Trace out to see if the potential camera location will be acceptable or not HitActor = Trace(HitLocation, HitNormal, PotentialCameraLocation, OutVT.POV.Location, true,,, TRACEFLAG_BULLET); // Check if the trace hit world geometry, if so then use the hit location offseted by the hit normal if (HitActor != None && HitActor.bWorldGeometry) { OutVT.POV.Location = HitLocation + HitNormal * 16.f; } else { OutVT.POV.Location = PotentialCameraLocation; } } }



Reply With Quote

Bookmarks