Comments (6)
I'm using this. I want to put in a face -> ray intersection test, I'll probably appropriate the one from sylvester. I currently have a heightfield -> ray intersection function, but it only works for rays that are parallel to the y axis. ;D
THREE.Ray = function ( origin, direction ) {
this.origin = origin;
this.direction = direction;
}
THREE.Ray.prototype = {
};
THREE.Ray.prototype.constructor = THREE.Ray;
from three.js.
I think this will work if I add getCenter() to the face class. It doesn't do a bounds test though.
intersection : function(face){
var A = this.origin,
D = this.direction,
P = face.getCenter(),
N = face.normal,
multiplier = (N.x*(P.x-A.x) + N.y*(P.y-A.y) + N.z*(P.z-A.z)) / (N.x*D.x + N.y*D.y + N.z*D.z);
return new THREE.Vector3([A.x + D.x*multiplier, A.y + D.y*multiplier, A.z + D.z*multiplier]);
}
from three.js.
i do face intersection tests in my new fork, the face center is not needed. Ideally I'd like to make the intersection check reusable, but everything is stowed away in ClickResolver.js right now.
from three.js.
Here is the commit for the 3d onclick detection / event handling:
http://github.com/mindlapse/three.js/commit/64e23a7204628998791bbd4db5d6d9355ccc1131
The code is still pretty new
from three.js.
Yeah. I'm struggling on what should be the right naming for all this...
Having a Ray.js as a base with the intersection methods there sounds like a good idea. Then maybe a Unproject to convert 2D coords to a 3D ray?
from three.js.
This is how it turned up:
https://github.com/mrdoob/three.js/blob/master/src/core/Ray.js
from three.js.
Related Issues (20)
- Matrix3 rotate why (- theta) in premultiply argument HOT 1
- Circular dependency in NodeMaterial HOT 6
- There is an issue with the GLB model display HOT 2
- WebXR polyfill broken since before 2020. Ok with Babylon HOT 8
- Transparent model does not render on some machines HOT 11
- There is an issue loading the GLB model in the form of the NPM package HOT 1
- USDZLoader: Invalid zip file when parsing usd file HOT 6
- feat: disable color interpolation / flat colors
- blender3.5.1 export a glb is disabled in threejs HOT 1
- Texture: Performance issues with hardware sRGB decode. HOT 44
- Don't set redundant state in the WebGPURenderer
- `renderer.toneMapping` not affecting `CubeTexture` background HOT 2
- Allow for updating specific regions of a canvas texture instead of the entire texture HOT 5
- OrbitControls HOT 2
- Allow supressing WebXR camera update logic to provide adjusted/manual camera matrices HOT 2
- Add a security policy
- Trasparency fluctuates per camera position HOT 2
- PLYLoader : RangeError: Offset is outside the bounds of the DataView HOT 3
- WebGPURenderer produces washed out colours compared to WebGL HOT 14
- Raycast points with fixed size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from three.js.