max-mapper / max-mapper/voxel-engine

Allow camera overide in opts

Open
#45 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.3k
Forks
217
PR merge metrics
No merged PRs in 30d

Description

I've been trying to get the voxel-engine to accept a custom camera (ie: OrthographicCamera )
and it would seem that the Game prototype needs something like this:

this.camera = this.createCamera( opts.camera || false )

and createCamera needs changing like so:

Game.prototype.createCamera = function( customCamera ) {
  camera = customCamera || new THREE.PerspectiveCamera(60, this.width / this.height, 1, 10000)
  camera.lookAt(new THREE.Vector3(0, 0, 0))
  this.scene.add(camera)
  return camera
}

Does this seem like a good idea, or am I being stupid? If not then pull request to follow.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Game.prototype.createCamera and the Game initialization that creates the camera; inspect how opts is passed and how THREE cameras are added to the scene. Confirm that a supplied OrthographicCamera is used while the default PerspectiveCamera behavior remains unchanged, then verify the resulting camera is added to the scene and positioned as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, three.js
Domain
game-dev
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.