Jump to content

How to lower the camera while in first person (papyrus)


trepleen

Recommended Posts

I've been wondering about this for the longest time.

 

The easiest way to lower the height of the first person camera is to simply set the scale of the player lower:

game.getplayer().setscale(0.5)

This may cause problems for first person perspective mods, any feedback would be welcome.  The npc will still look at the player correctly.

 

Now, you'll probably want to set the scale of the player only when they're in first person mode, so you'll need an event that knows when the player is in first or third person.

 

Here is code to know when the camera is in first person or third person (SKSE 1.7.1 and above):

Event OnInit()
    ;OnInit only fires when a new game is started
    RegisterForCameraState();Register for camera states
EndEvent
 
Event OnPlayerCameraState(int oldState, int newState)
    if newState == 0
        Debug.Trace("The Camera is in First Person mode.")
        game.getplayer().setscale(0.5) ;player is half the size, hence first person camera is lowered
    endif

    if newState == 9 
        Debug.Trace("The Camera is in third person mode.")
        game.getplayer().setscale(1.0) ;player is normal size again, default
    EndIf    
EndEvent

http://www.creationkit.com/OnPlayerCameraState_-_Form

 

This is a new thing I'm trying, so I'm not sure if any side effects that may occur, i'll keep the post updated.

 

LOWER THE CAMERA USING NIOVERRIDE SCRIPT (Thanks to Expired!!)

 

This is experimental code, it does not work unfortunately, if you figure it out please let me know.

; Adds a position override for the particular key, pos[0-2] correspond to x,y,z
Function AddNodeTransformPosition(ObjectReference akRef, bool firstPerson, bool isFemale, string nodeName, string key, float[] pos) native global
NiOverride.AddNodeTransformPosition(ref, true, isFemale, "Camera1st [Cam1]", "MY_MOD", pos)

float[] pos = new float[3]
pos[0] = 0
pos[1] = 0
pos[2] = -30 

NiOverride.RemoveNodeTransformPosition(ref, true, isFemale, "Camera1st [Cam1]", "MY_MOD")
Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...