SAC Posted March 4, 2019 Posted March 4, 2019 Hi, As the title says, I am trying to attach a "functioning" 3p camera to NPCs. "Functioning" = the player should be able to move around and zoom the camera around the NPC, same as if the player was using the 3p camera on themselves So far I am using this script: Game.SetPlayerAIDriven(true) Game.ForceThirdPerson() Game.SetCameraTarget(target) Game.ForceFirstPerson() Game.ForceThirdPerson() when attaching to the NPC, then <script stuff goes on>, then Game.SetPlayerAIDriven(false) Game.SetCameraTarget(game.getplayer()) Game.ForceFirstPerson() when the script is finished, and I want to revert the camera back to the player This is yielding a semi-satisfactory result, meaning: - I can zoom in and out, but zoom in is limited - I cannot move / pan the camera around (which is a must for me) Any help progressing this further (first priority would be being able to move the camera) would be greatly appreciated, and integrated into my exploding collar mod here TY!
Carreau Posted May 6, 2019 Posted May 6, 2019 Here’s what I did: Game.SetCameraTarget(akActor) Game.ForceFirstPerson() Utility.Wait(0.2) Game.ForceThirdPerson() Utitlity.SetINIBool(“bApplyCameraNodeAnimations:Camera”, 0) Utility.SetINIFloat(“fVertibirdVanityModeMaxDist:Camera”, fCameraDistance) The camera diatance tends to be real far out with default distances. So I usually clamp it with a value, hence the max distance set. now, the controls can get a bit wonky, but you can pan around and zoom requires holding V and moving the mouse, if I remember correctly. When I revert the camera back to the player, I just reuse the same script lines except substituting the player in for camera target, a different value for vanity distance, and I set the node bool back to 1. Game.SetCameraTarget(PlayerRef) Game.ForceFirstPerson() Utility.Wait(0.2) Game.ForceThirdPerson() Utitlity.SetINIBool(“bApplyCameraNodeAnimations:Camera”, 1) Utility.SetINIFloat(“fVertibirdVanityModeMaxDist:Camera”, fCameraDistance2) i also poll the player’s camera view before the camera switches to the NPC to know whether to return to 1st or 3rd person pov. So positioning the camera comes last as to avoid the always CTD bug requires on my testing to force POV to 1st and 3rd before final POV force
SAC Posted May 11, 2019 Author Posted May 11, 2019 On 5/6/2019 at 7:16 PM, Carreau said: Here’s what I did: Game.SetCameraTarget(akActor) Game.ForceFirstPerson() Utility.Wait(0.2) Game.ForceThirdPerson() Utitlity.SetINIBool(“bApplyCameraNodeAnimations:Camera”, 0) Utility.SetINIFloat(“fVertibirdVanityModeMaxDist:Camera”, fCameraDistance) This is not working for me, the NPC camera is stuck in 1st person
Carreau Posted May 11, 2019 Posted May 11, 2019 For anything like fCameraDistance, you're substituting a value of your own, right? I use 200 when I set the camera to the NPC and then 2000 (default) when I return the camera to the player. I threw a generic sounding variable in there, but forgot to explain that part.
SAC Posted May 12, 2019 Author Posted May 12, 2019 13 hours ago, Carreau said: For anything like fCameraDistance, you're substituting a value of your own, right? I use 200 when I set the camera to the NPC and then 2000 (default) when I return the camera to the player. I threw a generic sounding variable in there, but forgot to explain that part. I figured that out about the distance, but it still doesn't work for me: Game.SetCameraTarget(target) Game.ForceFirstPerson() Utility.Wait(0.2) Game.ForceThirdPerson() Utility.SetINIBool("bApplyCameraNodeAnimations:Camera", 0) Utility.SetINIFloat("fVertibirdVanityModeMaxDist:Camera", 200) 1. when the NPC is alive, the camera is stuck in first person, and I can only look left-right by holding the middle mouse button; if I tfc in that state, the NPC is invisible, meaning the camera was in 1st person 2. when the NPC dies in that camera state, the camera moves to third person pointing at the NPC, and I can only rotate it left-right (not up-down, not away) again by holding the mmb I have tried also with "camera node" 1, same effect
Carreau Posted May 12, 2019 Posted May 12, 2019 You got me there. I can tell you that the way I code it up, it works for me. Have you checked your debug log for any errors?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.