0
votes

Problem: Models loaded with SceneLoader() intersects wrong with raycasters.

Simple example:

http://golem.fjfi.cvut.cz/virtual/matusu/GitHub/Git.html

There is a mesh added in program, with which should raycaster intersect (can't find why at the moment, maybe I'll be able to fix this in next hour). Second object (floor) in variable "models" (should intersect with ray) is a model loaded from blender.

Gravity ray is visualized with arrow for clarity.

I've been looking for mistake for about month, but couldn't find anything. Whole problem is, that in model from issue mentioned below, it seems that model loaded with SceneLoader intersects with raycaster as invisible model rotated by (PI/2,0,0).

This is a simplification of issue

three.js: sceneLoader & rays issue

How can I intersect loaded models via SceneLoader (JSONLoader works fine) with rays?

1
Don't debug with three.min.js -- use three.js. Nothing needs to animate to demonstrate a problem -- create a static scene. All you need is one ray and one loaded object. Simplify!WestLangley

1 Answers

0
votes

Ok, I have probably found, where the problem is. It's in blender exporter, because all exported files have in section transform from some reason rotation set to (-PI/2,0,0). It doesn't influences models position or so (probably takes just their geometry and their rotation), but all computations like raycaster's intersections do. When I set this parameter to (0,0,0), everything works fine.

But it makes bigger problem than just models from blender. Raycaster was unable to find intersection even with model added in program itself (Cube geometry in this case). So this transform parameter applies on whole scene when loading this file.

Example:

This is file, which loads simple geometry exported from blender with scene loader, but I haven't changed transform parameter yet:

http://golem.fjfi.cvut.cz/virtual/matusu/GitHub/Git_default.html

And this is the exactly same program loading same file, but with changed parameter transform.rotation to (0,0,0).:

http://golem.fjfi.cvut.cz/virtual/matusu/GitHub/Git_changed.html

Thanks for that reminder of simplifying! It helped quite a lot! Hope this topic will help to show this small bug (transform non zero setting probably has some reason, but is problematic in this point).

P.S.: I use blender exporter version 2.66