K
K
Kirill Petrov2015-01-09 15:25:31
JavaScript
Kirill Petrov, 2015-01-09 15:25:31

How to load mesh object geometry from three.js to cannon.js?

There is an example , I can’t understand how to process the geometry of a mesh object and how to feed it to cannon.js.
Mesh I get from ColladaLoader.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Petrov, 2015-01-12
@Recosh

With the help of hacd , I disassembled the model, and gave it to ConvexPolyhedron () if this is not done, something like
figure3.gif

S
SHVV, 2015-01-12
@SHVV

Apparently:
new Trimesh(vertices, indices);
creates a mesh collider from an array of vertices and triangle indices.
In three.js, a mesh has a geometry (geometry), an octor has similar arrays: vertices and faces. Only they are made up of objects, not numbers. So all you have to do is turn the arrays of objects into arrays of numbers and feed them to cannon.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question