Jump to content

Reposition decals


Raitch
 Share

Recommended Posts

If the arrow was pointing "downwards" all the time, using wAng would be a piece of cake, but it seems to be in different angles depending on where on the sphere you hover. I don't really get this part of the code, so am not sure if it's easy to fix


                BABYLON.Vector3.CrossToRef(start, axis1, axis2);
                BABYLON.Vector3.CrossToRef(axis2, axis1, axis3);
                var tmpVec = BABYLON.Vector3.RotationFromAxis(axis3.negate(), axis1, axis2);
                var quat = BABYLON.Quaternion.RotationYawPitchRoll(tmpVec.y, tmpVec.x, tmpVec.z);
                if (pickInfo.pickedMesh.rotationQuaternion)
                    box.rotationQuaternion = pickInfo.pickedMesh.rotationQuaternion.multiply(quat);
                else
                    box.rotationQuaternion = quat;

Link to comment
Share on other sites

Ahh, yes, this is derived from "surface-following Susanne"  (#8 in the series).  Sorry about that.  I gave you a bad answer.

Texture wAng is not controllable or predictable... when the mesh itself is Z-rotating.  *nod*  We might need to say goodbye to quaternions, and try something like billboard mode (pretend camera inside sphere). 

Unfortunately, billboard suffers z-spin near the poles... and that will kill THAT idea, too.

Interesting challenge. 

Have you tried standard plane... with setPivotMatrix at sphere center?   I suppose that method has problems if/when the sphere has some mountains and valleys on it.

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