Jump to content

Set camera angle [SOLVED]


ggg
 Share

Recommended Posts

Hi ggg!  http://www.babylonjs-playground.com/#10AS2Y#1

Here is a playground with various freeCamera aiming.  Is that what you mean by "view angle"?  Or do you mean "field of view"?  (camera.fov and .fovMode)

Anyway, line 7 sets the camera initial position, and line 10 is one way to aim the camera.  Lines 33-34 is another way.  Activate lines 38-39 for aiming-by-math.

I hope I am on-topic.  :)  Perhaps we are talking about the "view matrix"?   The Camera base class has some interesting properties and methods.  FreeCameras inherit them all, plus some more from targetCamera.  FreeCameras are great little cameras... esp considering they are free!  (ar ar ar)  :)

Know how to use your browser's object inspector?  Do console.log(camera) and then click on the word 'object'.  The object inspector should open.  Then you can view and even SET some values on the freeCamera... LIVE.  Viewing cameras, lights, mesh, ANY JS object... with an object inspector... is an excellent way to learn things FAST.  I love 'em.  console.log(object)... RUN... then go to console and click on it.  :)  Object sniffing is FUN!

Hope this helps.

Link to comment
Share on other sites

54 minutes ago, Wingnut said:

Hi ggg!  http://www.babylonjs-playground.com/#10AS2Y#1

Here is a playground with various freeCamera aiming.  Is that what you mean by "view angle"?  Or do you mean "field of view"?  (camera.fov and .fovMode)

Anyway, line 7 sets the camera initial position, and line 10 is one way to aim the camera.  Lines 33-34 is another way.  Activate lines 38-39 for aiming-by-math.

I hope I am on-topic.  :)  Perhaps we are talking about the "view matrix"?   The Camera base class has some interesting properties and methods.  FreeCameras inherit them all, plus some more from targetCamera.  FreeCameras are great little cameras... esp considering they are free!  (ar ar ar)  :)

Know how to use your browser's object inspector?  Do console.log(camera) and then click on the word 'object'.  The object inspector should open.  Then you can view and even SET some values on the freeCamera... LIVE.  Viewing cameras, lights, mesh, ANY JS object... with an object inspector... is an excellent way to learn things FAST.  I love 'em.  console.log(object)... RUN... then go to console and click on it.  :)  Object sniffing is FUN!

Hope this helps.

Thanks for the kind reply. Unfortunately, the mentioned PG was not of good help in my needs. Here is my PG http://www.babylonjs-playground.com/#TA6A7#2 in which I want to set the default camera angle so that, the lines are visible in 3D. Currently it is viewd in 2D. We can see in 3D only when we rotate the canvas. But I want the canvas to be seen in some other camera angle so that, the lines are viewed in 3D. Could you please help?

Link to comment
Share on other sites

16 hours ago, JohnK said:

Line 12 in your PG sets the camera angles

More about arcRotateCamera here http://babylonjsguide.github.io/basics/Cameras#arc-rotate-camera

Thanks for the quick guide JohnK. Would you also please advice me how do I set the camera distance? Now, I could set the camera angle. But When the lines draw, I needed to scroll my mouse up/down to see the lines in full view. If I could set the camera view distance, that would be really great. Could you advice on this please?

Link to comment
Share on other sites

15 hours ago, JohnK said:

If you read tutorial on arcRotateCamera, as given in my link, you will see distance is radius, the second parameter.

Thanks for the advice JohnK. It was really helpful and I was able achieve my idea to reflect on web page. Thanks again! 

Link to comment
Share on other sites

  • ggg changed the title to Set camera angle [SOLVED]

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...