Jump to content

Selecting 3d coordinates in a scene

Recommended Posts


Is there any way to read 3d coordinates (x,y,z) in a scene? I have tried using the following code:

//When pointer down event is raised
scene.onPointerDown = function (evt, pickResult) {
    // if the click hits the ground object, we change the impact position
    if (pickResult.hit) {
        x = pickResult.pickedPoint.x;
        y = pickResult.pickedPoint.y;
        z = pickResult.pickedPoint.z;

But I could not read the value of z.

Link to comment
Share on other sites

Hunts suggestion should have led you to the problem. To be helpful I suggest you always give a PG where possible and not a limited part of the code. It could be that somewhere else you swapped a z for a Z and so the error would lie elsewhere rather than in the section of code you include.

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.

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.


  • Recently Browsing   0 members

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