Skip to content

Conversation

@jacokotze
Copy link

@jacokotze jacokotze commented Mar 18, 2023

Add support for multiple cameras whilst keeping a predefined camera.

Semi-breaking due to needing users to use g3d.camera.current() in order to retrieve the current camera.

Move Camera to an object, with the static component tracking the "current" active camera.

Additionally models may now specify a camera to draw with, defaulting to the current active camera.

Tested in a local project roughly :

local g3d = require('g3d')
local cameras = { "camA"=g3d.camera.current(); "camB"=g3d.camera.newCamera() };

function love.load()
 cameraUsed = "camA"
end

function love.keypressed(key, scancode)
 if key == "f" then
  if cameraUsed == "camA" then
   cameraUsed = "camB"
  else
   cameraUsed = "camA"
  end
  g3d.camera.setCurrent(cameras[cameraUsed])
 end
end

-- love.draw(); love.update() as per demo

Causes the game to switch between cameras.

Could be useful when using multiple view games (in game cctv etc)

@jacokotze jacokotze marked this pull request as ready for review March 18, 2023 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant