Mouse or keyboard control to move camera 'position' (scroll)?

212 views
Skip to first unread message

Jim Deane

unread,
Feb 8, 2017, 10:06:10 AM2/8/17
to Glowscript Users
The mouse actions for zoom and rotate (rotate object, or rotate camera around where it points) are well documented.

Is there a way to scroll? One of my students is working on a solar system, and wants to be able to scroll to the planets as he is developing it. Meaning, the scene is created with the center of the sun at the origin, and the origin is the center of the view. He would like to "scroll right" so that he can center the view on another planet or feature.

Is that possible?  The only solution I've come up with is to change the camera scene.center to each successive planet before running the program. That's not ideal. I suppose I could make a slider that would let him slide left/right, but I'm not sure whether scene.camera.pos and scene.center need to be changed in unison to make the camera "scroll" left/right/up/down.

Bruce Sherwood

unread,
Feb 8, 2017, 10:26:25 AM2/8/17
to Glowscript Users
When you change scene.center without changing scene.forward, the camera position is moved to point at the new center, pointing in the same vector direction at before. Here are all the details:


Jim Deane

unread,
Feb 8, 2017, 10:41:24 AM2/8/17
to Glowscript Users
So we could make a slider that would allow us to change scene.center. I'll have to give that a try.

Might put that as a...low priority...feature request.  Some sort of mouse action that would do that. (Alt + right click + scroll l/r/u/d).

Bruce Sherwood

unread,
Feb 8, 2017, 10:58:40 AM2/8/17
to Glowscript Users
Keep in mind that GlowScript programs run on mobile devices, where you can't press Alt and drag your finger. I think the only way to add camera options would be to display an icon at the top of the canvas.
Reply all
Reply to author
Forward
0 new messages