You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first, thanks for helping me with #1603. I got jigLibs running und started to play around.
As I'm trying to get a dice rolling and read it's value, which is meant to be the top side, I found #1606 and thought, that I'd might be helpful in my case. So I got the dice rolling and it worked out well. The next step is to evaluate the value.
My camera is placed above the dice high on the Y-Axis and rotated on the X-Axis for a top-down view.
Now I'd thought, that I'll create a ray with the origin in the dice.position and going straight forwards the camera. The vector for this direction would be achieved as told in #1606, by extracting the rotation from the dice's matrix.
But I don't know yet how to continue. I tried assigning the dice's faces to a variable so I could loop them somehow to see which face was "hit" by the ray. But it returns a "undefined" when checking the value of the "dice.faces".
Am I on the wrong path? Isn't it possible to let the ray hit the dice and somehow check every face if it was hit, so I could determine the face and it's value attached to it?
Also I'd be very handy if someone of you would have worked with jiglib and the rigidBody method "addBodyForce", for it requires two vector as input, but using Three.Vector3 doesn't seem to work for me.
I set up a jsfiddle of my actual situation. The dice is rolling and I commented out my thoughts on the "addBodyForce" method.
The "ray thing" hasn't been implemented yet, because I wasn't sure if it was the right attempt.
EDIT:
So "meanwhile" I learned, that the object returned by the intersect method of Ray.js contains the face or face id of the intersected object. That'd mean I could simply compare the IDs of the dice with the ID of the intersected object, right?
The text was updated successfully, but these errors were encountered:
Thanks for the assurance. I identified the values by comparing the materialIndex of the top face with the order of assigned textures. Thank you for your help
Hey,
first, thanks for helping me with #1603. I got jigLibs running und started to play around.
As I'm trying to get a dice rolling and read it's value, which is meant to be the top side, I found #1606 and thought, that I'd might be helpful in my case. So I got the dice rolling and it worked out well. The next step is to evaluate the value.
My camera is placed above the dice high on the Y-Axis and rotated on the X-Axis for a top-down view.
Now I'd thought, that I'll create a ray with the origin in the dice.position and going straight forwards the camera. The vector for this direction would be achieved as told in #1606, by extracting the rotation from the dice's matrix.
But I don't know yet how to continue. I tried assigning the dice's faces to a variable so I could loop them somehow to see which face was "hit" by the ray. But it returns a "undefined" when checking the value of the "dice.faces".
Am I on the wrong path? Isn't it possible to let the ray hit the dice and somehow check every face if it was hit, so I could determine the face and it's value attached to it?
Also I'd be very handy if someone of you would have worked with jiglib and the rigidBody method "addBodyForce", for it requires two vector as input, but using Three.Vector3 doesn't seem to work for me.
I set up a jsfiddle of my actual situation. The dice is rolling and I commented out my thoughts on the "addBodyForce" method.
The "ray thing" hasn't been implemented yet, because I wasn't sure if it was the right attempt.
JSFiddle: http://jsfiddle.net/XLGbm/
Thanks for reading the issue.
EDIT:
So "meanwhile" I learned, that the object returned by the intersect method of Ray.js contains the face or face id of the intersected object. That'd mean I could simply compare the IDs of the dice with the ID of the intersected object, right?
The text was updated successfully, but these errors were encountered: