MackeyK24 Posted December 13, 2016 Share Posted December 13, 2016 I don't seem to see a CreateCapsule in MeshBuilder... I see the CreateCylinder but it does not have "Top" and "Bottom" part of a capsule. How can i create a capsule... Note i already "STEAL" pieces of code from framework to make box and sphere collider meshes... But don't know how to create an actual sphere... Anybody know how... This is what my existing "STOLEN" code looks like for box and sphere... Pretty simple... was hoping capsule would be just as simple: private static applyBoxCollider(box:BABYLON.Mesh, options: { size?: number, width?: number, height?: number, depth?: number, faceUV?: Vector4[], faceColors?: Color4[], sideOrientation?: number, updatable?: boolean }, scene: Scene): void { options.sideOrientation = this.updateSideOrientation(options.sideOrientation, scene); box.sideOrientation = options.sideOrientation; var vertexData = VertexData.CreateBox(options); vertexData.applyToMesh(box, options.updatable); } private static applySphereCollider(sphere:BABYLON.Mesh, options: { segments?: number, diameter?: number, diameterX?: number, diameterY?: number, diameterZ?: number, arc?: number, slice?: number, sideOrientation?: number, updatable?: boolean }, scene: any): void { options.sideOrientation = this.updateSideOrientation(options.sideOrientation, scene); sphere.sideOrientation = options.sideOrientation; var vertexData = VertexData.CreateSphere(options); vertexData.applyToMesh(sphere, options.updatable); } private static updateSideOrientation(orientation: number, scene: Scene): number { if (orientation == Mesh.DOUBLESIDE) { return Mesh.DOUBLESIDE; } if (orientation === undefined || orientation === null) { return Mesh.FRONTSIDE; } return orientation; } @Sebavan or @Deltakosh You guys know where I'm going with this... It for "Colliders & Triggers" support in the toolkit Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 13, 2016 Share Posted December 13, 2016 Hi Mack. I'm not one of them guys, but I found this PG... http://www.babylonjs-playground.com/#13HGWT#2 Whomever created this... was using spheres merged-onto a cylinder... to create a capsule. Recently, I learned how to create hemispheres... using meshbuilder. I replaced the spheres with the hemispheres (no real reason... just prettier in wireframe) It looks as though the hemi's have caps, but they don't. The cylinder has caps, and no easy removal. You may wish to use a meshBuilder tube (has capping options) instead of a cylinder. Hope this helps. Perhaps createCapsule is in our future, eh? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 13, 2016 Author Share Posted December 13, 2016 Thanks @Wingnut Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted December 13, 2016 Share Posted December 13, 2016 @MackeyK24 hi it alternative solution : capsule : http://www.babylonjs-playground.com/#1QC9DP#63 with UV : http://www.babylonjs-playground.com/#1QC9DP#64 read more here: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.