Open Tezirg opened 9 years ago
Hi,
if you need convex/trimesh collisions, then you must implement it :) There's no working convexTrimesh
method, which you use in your code above.
There's already Ray and Plane classes? What would a Triangle class do, would it be a shape?
I didn't implement the math classes you mention because they're not really needed internally in the engine. If you need them then please add them, but keep them out of the core lib to save bytes :)
I have been looking at SIMD for a while and it's probably a good idea to use if it's supported in the browser. I like the way glMatrix does it, it just defaults to SIMD if SIMD is available, but keeps the scalar method available. Unfortunately, the math classes would need to switch to using typed arrays (Float32Array) to get any performance gain from SIMD. In other words, no x,y,z properties (unless we make getters for them).
Hey, indeed convexTrimesh is missing, I will try to implement it.
About ray, plane and triangle classes. What I need is a math class to manipulate them, not a shape. Because for trimesh intersect you need to be able to test faces(triangles) for intersection. Plus I'm not very sure of hoe to perform efficent trimesh intersection :p
Well, I will see what I can do. Currently implementing a vector_math.js lib with Float32Array as storage data structure. I will first implement a scalar version, then I'll add SIMD support I guess.
And btw, I don't understand how testing works on cannon.js, any clue ? Thanks ;)
I guss you could add some helper classes for ray and plane if you need them.
Test are using nodeunit, tests are located in test/
, and you can run the tests using grunt test
.
Thanks, I'll keep you updated
Hello, here we are on the best js library and functionalities are missing ! It is unfortunate that meshes cannot intersect each other or even with boxes. I read a bit on this part, and in fact cannon.js is missing two functions :
since [box|cylinder/trimesh] intersects can be impemented as follow
First, can you confirm that i'm right ? Then, I'd like to help you with that but i'm missing Math tools such as Ray, Plane(ax+by+cz+d = 0) and Triangle. Is also missing Vector2 / Vector4 / Mat2 / Mat4. (Maybe we should make all of them with SIMD. Have a look at https://github.com/google/vector_math.dart)
Thanks a lot for analysing this issue and for this awsome lib ! Tezirg