nunuStudio
nunuStudio copied to clipboard
Raycasting objects are not found where they visually are
Raycast on an object, it's not where it should be
Description
- With our latest exports from v0.98.27 all of our objects that we are trying to interact with are no longer where they are, the ray caster is somehow picking them up way far off (down & to the right). Tested with a brand new scene and are getting the same results
Note: If you run the included test scene in the editor, the ray caster picks it up just fine. It's not until you save/publish for web that you then have the issue.
Version
- 0.98.27
Platform
- Web Version [X]
- Windows [ ]
- Linux [ ]
+1 for this issue. As far as we can currently tell, it's a showstopper for our project. Thanks for looking into it!
So after some more playing with this bug and now setting up our own version of nunu on our web server so we can move forward with work, I've determined that the issue is in the new default scene. When we pull in our scenes created from a pervious version of the default scene, make edits and save. No issues with our raycaster landing on the objects and returning it's found the object your mousing over. But the more intensive 3D side of our process involves basically folding the old scene into a new default scene, and that export is the one that was breaking our scenes raycaster.
Again our workaround we're testing right now is I've created a local branch of the main git repo and rolled back to the 8/5 0.98.15 version and we're using that version of the editor to iterate and work on our scenes for now.
Hello
This was caused by a bad update in the canvas size in the runtime. Thanks a lot for reporting this bug should be fixed in the last version but already available in the web (0.98.28).
I still need to perform additional testing to ensure that everything is working correctly. This may have been caused by some changes applied for the AR support.
Thanks a lot once again.
Cheers
Hey José
Unfortunately, it's still broken. Here are my steps to test/recreate:
- Start with loading page with default scene (using new version 0.98.28)
- Added a container, JS script, orbit controls, perspective camera
- Nested the camera in the orbit controls, and the orbit controls in the container
- Changed the orbit control variables as such • set distance, max distance, & min distance to .001 • set limit up to 0.533 and limit down to -0.533 • set vector to (1.15, 0.15)
- Change the container position to (3.1, 1.78, 4.87)
- To the script I modified it to read:
var box = scene.getObjectByName('box')
function initialize() {
// TODO ADD CODE
}
function update(delta) {
// TODO ADD CODE
var intersect = closestTappedObjectIn([box])
if (intersect != null) {
console.log('hovering on the box')
}
}
function closestTappedObjectIn(objects)
{
var intersects = [];
intersects = scene.raycaster.intersectObjects(objects);
var closestObject = null;
var closestDistance = 1000000;
for (var i = 0; i < intersects.length; i++) {
if (intersects[i].distance < closestDistance) {
closestDistance = intersects[i].distance;
closestObject = intersects[i].object;
}
}
return closestObject;
}
- Select run: • When you hover over the box, as expected you see printed out in the console 'hovering on the box`
- Select File->Publish (set my name to ray_cast_test28)
- Pointed my local web server to the downloaded unzipped director
Expected Results:
• When hovering over the box I should see the hovering on the box print out to the console
Actual Results:
• Nothing is printed when hovering over the box, but if I moved my cursor to the right and down, I'll eventually find a spot that the
raycaster
says my box is...
Thanks a lot for this data, it will be of great help for sure.
I Will come back with a solution as soon as possible.