Multiple camera's

93 views
Skip to first unread message

dhdeboer

unread,
Apr 23, 2017, 10:02:47 AM4/23/17
to CoSpaces
Hi, 

in the program I can place multiple camera's in a scene.
What I can't figure out is how to use more than one.
If I doubleclick a camera there's an option 'use as main camera', which suggests it ís possible to use more than one.
Any suggestions?

kind regards,

d de boer, netherlands

Benjamin Singh

unread,
Apr 24, 2017, 3:11:49 AM4/24/17
to CoSpaces
Hi,

you can make use of multiple cameras when you're scripting. For example switching the cameras during runtime of your script (e.g. in a game). Is that something you want to do? Other than that I don't see any advantages of using multiple cameras without scripting at the moment.

Best,

Benjamin

d boer

unread,
Apr 28, 2017, 6:03:51 AM4/28/17
to CoSpaces
For scripting I only use blockly at the moment. Can I change camera's using Blockly?

D Boer

Benjamin Singh

unread,
May 2, 2017, 5:48:21 AM5/2/17
to CoSpaces
Hi D Boer,

I realised that switching cameras using JavaScript or Blockly isn't directly possible. But we can use the "coding" block in Blockly to inject some JavaScript, but in this case not to switch the camera but to set the cameras position and facing direction. Here is an example:


Here a link to the scene: https://cospac.es/UVXO


1. We're getting the scene camera with the `Scene.getCamera()` method.

2. Getting the red and green cube using the `Scene.getItem(itemId)` method passing in the items id.

3. When clicking on a cube we're setting the cameras position by calling `camera.setPosition(xPos, yPos, zPos)` passing in world coordinates and...

4. ...let the camera face to the direction of the cube by calling `camera.faceTo(object)`.


I don't know if this helps you but I think it's the easiest way at the moment. I'll forward your feedback to the team, maybe we can add blocks to Blockly to make switching cameras more approachable.


Benjamin



Reply all
Reply to author
Forward
0 new messages