2

I am new on the JavaScript and HTML. I am on learning process. I successfully made a cube and textured it. I also want to add different html link to open pages in "iframe".

I used the example of http://mrdoob.github.com/three.js/examples/canvas_geometry_cube.html

This is what I did http://olcaysahin.com/pages/cube.html

If anyone knows any tutorial or similar approach to make each face clickable, appreciated.

Thanks

1 Answer 1

3

Have a look at http://mrdoob.github.com/three.js/examples/canvas_interactive_cubes.html.

The from variable intersects, you can determine which face was clicked on from either the faceIndex or the face normal.

Sign up to request clarification or add additional context in comments.

8 Comments

@Hamdi Please ask a specific question in a new post. Thanks.
ray.intersectObjects() takes an array as an arg. Try ray.intersectObject(), without the s.
Thank you @Hamdi and WestLangley. It works perfect. clickable function for the each cube face determined by the the normals. For reference just in case somebody needed it as follows: 'if(intersects[0].face.normal.x==0 && intersects[0].face.normal.y==0 &&intersects[0].face.normal.z==-1){window.top.location="www.google.com";'
@Hamdi Please do not forget to "accept" answers that you find acceptable. :-)
I voted up for your answer :) Let's ask @olcaysah if he accepts
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.