Nastro Posted August 17, 2016 Share Posted August 17, 2016 Hi When i click on a SPS Mesh i need to target camera on center of the SPS. But i can't get the bounding box to get center. Any ideas ? :/ Thanks Quote Link to comment Share on other sites More sharing options...
jerome Posted August 17, 2016 Share Posted August 17, 2016 sps.mesh.getBoundingInfo() ? http://doc.babylonjs.com/classes/2.4/AbstractMesh#getboundinginfo-rarr-boundinginfo-classes-2-4-boundinginfo- about how to set the SPS BBox (not automatic by default) : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility Quote Link to comment Share on other sites More sharing options...
Nastro Posted August 17, 2016 Author Share Posted August 17, 2016 Hi @jerome Thanks for answer. I tried SPSRoom.computeBoundingBox = true; SPSRoom.setVisibilityBox = meshRoom.getBoundingInfo().boundingBox; But when i call : scene.onPointerDown I get the general bounding of all SPS not specific SPS ... Quote Link to comment Share on other sites More sharing options...
Nastro Posted August 17, 2016 Author Share Posted August 17, 2016 scene.onPointerDown = function (evt, pickResult) { var meshFaceId = pickResult.faceId; // get the mesh picked face if (meshFaceId == -1) { return;// return if nothing picked } if (SPSRoom.pickedParticles[meshFaceId] === undefined) { return; } var idx = SPSRoom.pickedParticles[meshFaceId].idx; // get the picked particle idx from the pickedParticles array var p = SPSRoom.particles[idx]; // get the picked particle if (IdSPSRoom_RefPiece_Array[idx] === undefined) return; var bbox = SPSRoom.mesh.getBoundingInfo().boundingBox; arcCamera.setTarget(bbox.center); arcCamera.radius = (bbox.maximum.z - bbox.minimum.z) * 1.5; //alert(IdSPSRoom_RefPiece_Array[idx]); //p.color.r = 1; // turn it red //p.color.g = 0; //p.color.b = 0; //SPSRoom.setParticles(); }; Quote Link to comment Share on other sites More sharing options...
Nastro Posted August 17, 2016 Author Share Posted August 17, 2016 It's ok. I save in a array the bounding box of mesh before and i get it after to use it and get center. Thanks Jerome 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.