Jump to content

Skymaterial and Elevation of Camera


luan_ngo
 Share

Recommended Posts

Hi everybody, I've applied the sky material to a skydome and I'm quite happy with the results. But, I'm creating a game that includes aircraft flying quite high and am realizing that the skymaterial is attached to the camera.position.y rather than 0 or a specified mesh. So, when the camera is really high up, the horizon is also too high.

Is there an easy way to make the skymaterial relative to another height position or 0?

Here's a playground:

https://www.babylonjs-playground.com/#E6OZX#218

 

Thanks!

horizon.jpg

Link to comment
Share on other sites

Hey @luan_ngo,

Pull request just created: https://github.com/BabylonJS/Babylon.js/pull/5597

Updating the doc ASAP. Anyway, to keep your horizon at position 0 on Y, just setup the property .cameraOffset on the material which is a Vector3.
Example:

skyMaterial.cameraOffset.y = scene.activeCamera.globalPosition.y

Don't hesitate if you encounter a bug!

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