Search the Community
Showing results for tags 'transform matrix'.
-
Hello guys, im trying to join two meshes (spheres) with a cylinder.( maybe basic but i'm having hard times as a beginner). The problem is that the default cylinder constructor leaves you with just the ability to only set the size , diameter of both top and bottom, and tessellation · Mesh.CreateCylinder(name, height, diameterTop, diameterBottom, tessellation, scene, updatable) when i need to do something like · New Cylinder(vectorStart, vectorEnd, scene) i've tried something like: Cylinder = function(vstart,vend, scene){ var HALF_PI = Math.PI/2 ; var distance = BABYLON.Vector3.Distance(vstart, vend); var position = vend.clone().add(vstart).divide(new BABYLON.Vector3(2,2,2)); var material = new BABYLON.StandardMaterial("kosh", scene); var cylinder = BABYLON.Mesh.CreateCylinder("cylinder", distance, 1, 1, 36, scene, true); var orientation = new BABYLON.Matrix(); var offsetRotation = new BABYLON.Matrix(); orientation = BABYLON.Matrix.LookAtLH(vstart, vend, new BABYLON.Vector3(0,1,0)); offsetRotation =BABYLON.Matrix.RotationX(HALF_PI); orientation.multiply(offsetRotation); cylinder.bakeTransformIntoVertices(orientation);; cylinder.position = position;; } but it doesn't seem to work . maybe i'm having a really bad approach of the problem but actually i really don't know what to do . Can someone have any idea for me ? help will be so appreciated thanks in advance ! .
- 49 replies
-
- cylinder
- transform matrix
-
(and 1 more)
Tagged with: