Skip to content

Commit b57745c

Browse files
committed
Camera functions
1 parent b5f4cb8 commit b57745c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+778
-489
lines changed

functions/Camera/examples/fadeCamera-1.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function addRednessOnDamage ( )
2-
fadeCamera ( source, false, 1.0, 255, 0, 0 ) -- fade the player's camera to red over a period of 1 second
3-
setTimer ( fadeCameraDelayed, 500, 1, source ) -- don't let it go to opaque red, interrupt it after half a second and fade back to normal
2+
fadeCamera ( source, false, 1.0, 255, 0, 0 ) -- fade the player's camera to red over a period of 1 second
3+
setTimer ( fadeCameraDelayed, 500, 1, source ) -- don't let it go to opaque red, interrupt it after half a second and fade back to normal
44
end
55
addEventHandler ( "onPlayerDamage", root, addRednessOnDamage )
66

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function addRednessOnDamage ( )
2+
source:fadeCamera( false, 1.0, 255, 0, 0 ) -- fade the player's camera to red over a period of 1 second
3+
Timer ( fadeCameraDelayed, 500, 1, source ) -- don't let it go to opaque red, interrupt it after half a second and fade back to normal
4+
end
5+
addEventHandler ( "onPlayerDamage", root, addRednessOnDamage )
6+
7+
function fadeCameraDelayed(player) -- This function prevents debug warnings when the player disconnects while the timer is running.
8+
if (isElement(player)) then
9+
player:fadeCamera(true, 0.5)
10+
end
11+
end

functions/Camera/examples/getCameraClip-1.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function checkClipStatus()
2-
local obj, veh = Camera.getClip()
2+
local obj, veh = getCameraClip()
33
outputChatBox ("Your camera can" .. (veh and "" or "not") .. "see the vehicle interior at the moment!",255,0,0,false)
44
outputChatBox ("Your camera can" .. (obj and "" or "not") .. "collide with objects at the moment!",255,0,0,false)
55
end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function checkClipStatus()
2+
local obj, veh = Camera.getClip()
3+
outputChatBox ("Your camera can" .. (veh and "" or "not") .. "see the vehicle interior at the moment!",255,0,0,false)
4+
outputChatBox ("Your camera can" .. (obj and "" or "not") .. "collide with objects at the moment!",255,0,0,false)
5+
end
6+
addEventHandler("clipstatus",checkClipStatus)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
function outputCameraInterior ( player, command )
2-
local interior = getCameraInterior ( player )
3-
outputChatBox ( "The camera is in the interior " .. interior, player, 255, 255, 0 )
1+
function outputCameraInterior ( command )
2+
local interior = getCameraInterior()
3+
outputChatBox ( "The camera is in the interior " .. interior, localPlayer, 255, 255, 0 )
44
end
55
addCommandHandler ( "camera", outputCameraInterior )
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function outputCameraInterior ( player, command )
2+
local interior = getCameraInterior ( player )
3+
outputChatBox ( "The camera is in the interior " .. interior, player, 255, 255, 0 )
4+
end
5+
addCommandHandler ( "camera", outputCameraInterior )
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function outputCameraInterior ( command )
2+
local interior = Camera.interior -- or Camera.getInterior()
3+
outputChatBox ( "The camera is in the interior " .. interior, localPlayer, 255, 255, 0 )
4+
end
5+
addCommandHandler ( "camera", outputCameraInterior )
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function outputCameraInterior ( player, command )
2+
local interior = player.cameraInterior -- or player:getCameraInterior()
3+
outputChatBox ( "The camera is in the interior " .. interior, player, 255, 255, 0 )
4+
end
5+
addCommandHandler ( "camera", outputCameraInterior )
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
local x, y, z, lx, ly, lz = getCameraMatrix ()
2+
x, lx = x + 1, lx + 1
3+
4+
setCameraMatrix (x, y, z, lx, ly, lz)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
local x, y, z, lx, ly, lz = Camera.getMatrix()
2+
x, lx = x + 1, lx + 1
3+
4+
Camera.setMatrix(x, y, z, lx, ly, lz)

0 commit comments

Comments
 (0)