Hello all !
Iβm currently in the process of porting some custom projects and classes from Python3 (Numpy + OpenCV) toward BabylonJS (in Javascript TypeScript ). During my work I came across this funny test, so I share :
- Render β
GreasedLine
(@roland ) +Spheres
- Physics β Custom dummy computation (physics itself is about 10 lines of code in total)
If you want to give a test :
// This is the custom physics engine
const game = new Game(scene);
// Init a list of points. Pin list is indices of points to be pinned (still movable with mouse)
let pts = [];
for(let i=0; i<25; i++){
pts.push(new BABYLON.Vector3(-5+i, 8, 0));
}
const pin = [0, 12];
// Create line with pinned points
game.createLine(pts, pin);
// Create a bar constraint between two points
game.bars.push(new Bar(game.joints[6], game.joints[14]));
The constraints bar have a length automatically computed from distance between point at the time you create the constraint. To use another length, just give the length
param :
game.bars.push(new Bar(game.joints[6], game.joints[14], 2.0));
Hope youβll have fun
++
Tricotou