Jump to content

How to place objects on the surface of a sphere when/where the sphere is clicked?


mangomongo
 Share

Recommended Posts

When a sphere is clicked I want to place an object on the surface of the sphere where the sphere is clicked.

I have a playground that places an object at a random point on the surface when the sphere is clicked:

http://www.babylonjs-playground.com/#AV08NV

Can someone update the unitX, unitY and unitZ vars on lines 33-35 so that they reflect the point on the sphere that was clicked instead of random? These unit x, y and z values are between 0-1.

Link to comment
Share on other sites

Hey thanks, it's a bit off though. I forgot to mention that you can use the arrow keys to rotate the sphere. So you need to take the rotation into consideration when finding the point. And when you rotate the big sphere all the little white markers should rotate with the whole sphere. So I think you need to attach the white markers to the sphere using their parent property like I did in my playground.

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