Hello,
I want the camera to switch its position once the Player hits the trigger box. Like Resident Evil or PnC-adventures.
So after 20+ hours polishing my coding skill (which are still below room temperature) I came to this point here.
local CamRot = {}
CamRot[1] = 0
CamRot[2] = 270
CamRot[3] = 0
CamRot[4] = 0
CamRot[5] = 180
CamRot[6] = 0
local CamPos = {}
CamPos[1] = 5
CamPos[2] = 10
CamPos[3] = -5
CamPos[4] = -5
CamPos[5] = 10
CamPos[6] = 5
Cam1=1
Cam2=2
function Script:Cam1()--in
self.Cam1=1
end
function Script:UpdateWorld()
if self.Cam1==1 then
self.entity:SetRotation(CamRot[1],CamRot[2],CamRot[3])
self.entity:SetPosition(CamPos[1],CamPos[2],CamPos[3])
self.component:CallOutputs("inPosition1")
end
end
function Script:Cam2()--in
self.Cam2=2
end
function Script:UpdateWorld()
if self.Cam2==2 then
self.entity:SetRotation(CamRot[4],CamRot[5],CamRot[6])
self.entity:SetPosition(CamPos[4],CamPos[5],CamPos[6])
self.component:CallOutputs("inPosition2")
end
end
The problem is Cam1 and Cam2 is functional but if I add a connection with the FlowGraph it triggers only the last one. Someone with a solution?
Maybe I can only use one UpdateWorld function? I would like to use the GetChild, GetPosition functions and cycle the Camera between the added pivots but I dont how so far.
Self-trySetup; Triggerscript: Standard, Playerscript:Thirdperson(lockedcam), Camerascript: posted one
local CamRot = {}
CamRot[1] = 0
CamRot[2] = 270
CamRot[3] = 0
CamRot[4] = 0
CamRot[5] = 180
CamRot[6] = 0
local CamPos = {}
CamPos[1] = 5
CamPos[2] = 10
CamPos[3] = -5
CamPos[4] = -5
CamPos[5] = 10
CamPos[6] = 5
Cam1=1
function Script:Cam1()--in
self.Cam1=1
self.enabled=true
end
function Script:UpdateWorld()
if self.Cam1==1 then
self.entity:SetRotation(CamRot[1],CamRot[2],CamRot[3])
self.entity:SetPosition(CamPos[1],CamPos[2],CamPos[3])
self.component:CallOutputs("inPosition1")
if self.entity:SetRotation(CamRot[1],CamRot[2],CamRot[3])==true and
self.entity:SetPosition(CamPos[1],CamPos[2],CamPos[3])==true then
self.entity:SetRotation(CamRot[4],CamRot[5],CamRot[6])
self.entity:SetPosition(CamPos[4],CamPos[5],CamPos[6])
self.component:CallOutputs("inPosition2")
end
end
end
Here is another approch to the problem. It triggers only once as well.
A Screenshot of the scene for better understanding.