<h5 dir="auto">Description of the problem</h5>
<p dir="auto">Works only in Chrome</p>
<p dir="auto">If I use Raycaster to IntersectObject I can experience some unpredictable problem in extream slowdown of the raycasting.</p>
<p dir="auto">To reproduce that problem you should somewhere in the code declare Vector3 with strings in it's properties. Just create such Vector3 not use it:<br>
<strong>var test = new THREE.Vector3("foo", "bar", "baz")</strong></p>
<ul dir="auto">
<li><a href="https://jsfiddle.net/dnkorbut/8guscodm/1/" rel="nofollow">jsfiddle</a> (reproduced problem)</li>
</ul>
<ol dir="auto">
<li>Try to move your mouse around to see your FPS while moving the mouse</li>
<li>Click "slowdown" button at the top right corner</li>
<li>Move your mouse again to see huge performance drop</li>
</ol>
<p dir="auto">In real life we do not put strings to Vector3 properties but sometime people can get some poor JSON output or some other issues where the problem will be revealed only when you trying to use Raycaster and those not easily fixed. Vector3 works well with strings like "1.234" but Raycaster will be slowed down in such cases. So the problem can be seamless. You should always parseFloat before you put values to Vector3</p>
<h5 dir="auto">Three.js version</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Dev</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r100</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> ...</li>
</ul>
<h5 dir="auto">Browser</h5>
<ul class="contains-task-list">
<li>[] All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Chrome</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Firefox</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Internet Explorer</li>
</ul>
<h5 dir="auto">OS</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Windows</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> macOS</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Linux</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Android</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> iOS</li>
</ul>
<h5 dir="auto">Description of the problem</h5>
<p dir="auto">So I'm not sure what to even call this... I guess an oddity more than anything. I noticed this on a site i have when my raycasting was way slower than i had expected in certain scenarios. Here is the easiest way to reproduce:</p>
<ul dir="auto">
<li>Use this example: <a href="https://threejs.org/examples/webgl_geometry_terrain_raycast" rel="nofollow">https://threejs.org/examples/webgl_geometry_terrain_raycast</a></li>
<li>Move your mouse around and notice the fps (whatever it may be)</li>
<li>Open up the console and enter: var testVector = new THREE.Vector3("1",2,3);</li>
<li>Move your mouse around again... there should be a huge drop in fps (45 --&gt; 15 for me on my computer)</li>
<li>Set testVector.x back to some float/integer after making it a string.. it wont fix anything.</li>
</ul>
<p dir="auto">I just don't understand what the heck is going on. Was it my fault for creating a vector 3 with a string? Probably. But i just don't get how doing something like this grenades the performance of the entire scene. Maybe you could force a parseFloat on vector data?</p>
<p dir="auto">Im not sure if this bug makes all threejs actions slower or just raycasting, but that is where i noticed it the most.</p>
<p dir="auto">Extra notes: Doing the same thing with vector2/vector4 does nothing.</p>
<h5 dir="auto">Three.js version</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Dev</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r89 (example above)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r79 (my app)</li>
</ul>
<h5 dir="auto">Browser</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Chrome</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Firefox</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Internet Explorer</li>
</ul>
<h5 dir="auto">OS</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Windows</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> macOS</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Linux</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Android</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> iOS</li>
</ul>