Announcement

Collapse
No announcement yet.

Moving Camera to Front of Player

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Moving Camera to Front of Player

    Hey all. Trying to hammer out a strange issue with the camera for a third person-based game that requires the camera to effectively be in front of the player. Relevant snippets of the original third person code below.

    Code:
    CamStart = Location;
    
    DesiredCameraZOffset = (Health > 0) ? 1.5 * GetCollisionHeight() + Mesh.Translation.Z : 0.f;
    CameraZOffset = (fDeltaTime < 0.2) ? DesiredCameraZOffset * 5 * fDeltaTime + (1 - 5*fDeltaTime) * CameraZOffset : DesiredCameraZOffset;
    
    CamStart.Z += CameraZOffset;
    I'm looking to use the same layout of the offset code above to adjust CamStart, only utilizing the X and Y axes to keep the camera consistently in front of where the player faces. So far getting the right equation has been eluding me for quite a while, but I really can't fathom it being impossible this way. Any ideas or alternative coding methods?

    #2
    what class was that code found in?

    Comment

    Working...
    X