Jump to content

Better control of camera attachment


JCPalmer
 Share

Recommended Posts

I am starting in earnest the making of the orthographic 2nd camera for displaying dialogs in front of a scene.  Need to pick a camera, one that does NOT move, but handles only clicks / touches.  Any recommendations, or should I subclass Camera?

 

Also, is it a problem when 2 cameras try to attach?

Link to comment
Share on other sites

Hey JC, 

 

I needed a custom camera for one of my projects (with custom controls and custom behaviour), I tried subclassing FreeCamera, and it works great.

But for your this, I don't know if you really need to create a custom class. Why not use an arcRotate ?

 

http://www.babylonjs-playground.com/#1EXXKT

 

There is no problem to attach two camera, but only the last one will be set as activeCamera.

If you want to handle multiviews, you need to push both cameras in scene.activeCameras (notice the 's' at the end).

 

http://doc.babylonjs.com/page.php?p=22461

Link to comment
Share on other sites

Temechon,  Thanks for the playground.  I was planning on doing most of my work right in the HTML initially, then switch to typescript once developed.  Any camera camera works for that.  I pasted your 5 ortho line in my Dialog Test / Demo page.  Page looked a little better & not quite as wide ( I thought I was looking directly at it already). 

 

Something weird also happened:  With the mouse button down, dragging left-right rotates the panel in the opposite direction from before.  Could not reproduce in the playground example.

 

True, Arc rotate never moves, but stray drags / gestures could rotate it.  I have a hard requirement for a proprietary control / BasePanel subclass that I will build outside of the repository.  It must not move and always be viewed straight on.  Do not wish to limit others with my special requirements.  If only there was a way to switch to pick only attachment.  I am not the first to have a reason for wanting this.

 

http://www.html5gamedevs.com/topic/11151-move-arcrotatecamera-only-under-certain-conditions/?hl=attachcontrol

Link to comment
Share on other sites

Whoops, I can use Arc rotate camera with the same trick as above.  I got confused with the ".state" thing when it was the angularSensibility which froze it.

arcCamera.angularSensibility = Infinity;arcCamera.state = "off";

So Arc rotate it is.  Will have a switch that makes it more apparent.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...