nudibranchrecords / hedron

Perform live shows with your three.js creations
GNU Affero General Public License v3.0
480 stars 22 forks source link

Camera controls as a param #55

Closed funwithtriangles closed 1 month ago

funwithtriangles commented 6 years ago

It would be useful to have optional built in camera controls (e.g. OrbitControls) for easy inspection of a scene.

This feature should be focused as a debugging tool and not something for doing shows with (fancy camera controls for performances can be implemented per project using the scene parameter passed to each sketch upon construction).

funwithtriangles commented 6 years ago

It's worth mentioning that it is very easy to get this working inside a sketch file. As of https://github.com/nudibranchrecords/hedron/pull/56 there is now a class on the parent of the viewer canvas.

const OrbitControls = require('three-orbitcontrols')

...
 // viewerEl only needed so that mouse events only work inside the viewer and not the whole app UI
const viewerEl = document.getElementById('viewer')
// scene passed in as first agument of the sketch constructor
const controls = new OrbitControls(scene.camera, viewerEl)

This is clearly a bit of a hacky approach so it might still be good to have this as core functionality, however I wonder if it makes more sense to offer this solution in the docs or provide a boilerplate.

Keeping this open for discussion.

funwithtriangles commented 6 years ago

Camera controls should be available as a paramater of some sort. Perhaps position and rotation as 6 different params. Would be much more useful once we have new param types (could have a 3D mouse control param type that affects all 6 params). Need to think about how would be incorporated. Could be added to sketches by author or just be a "core param" of some sort.