ian Posted February 5, 2017 Share Posted February 5, 2017 How can I get vertex where Ball(Sphere) collide with Ground? Can anybody help me solve this problem? var perplexusIntersectionPoint = 0; if (perplexus.intersectsMesh(playBall, true)) { vertex(x,y,z) of perplexus where playBall/Sphere collide with perplexus/Mesh } Quote Link to comment Share on other sites More sharing options...
JohnK Posted February 5, 2017 Share Posted February 5, 2017 Both of these might be worth a look and see if you can adapt. Quote Link to comment Share on other sites More sharing options...
JohnK Posted February 5, 2017 Share Posted February 5, 2017 Actually its a lot easier than my suggestions above - sphere centre at (x, y, z) then contact with ground at (x, ground.position.y, z) since ground in horizontal plane. Quote Link to comment Share on other sites More sharing options...
ian Posted February 5, 2017 Author Share Posted February 5, 2017 ground.position.y is always same (ground have his own origin/pivot point and ground.position.y is ground's origin vertex). If ground is diagonally/alive/when_you_rotate_in_runtime than this ground.position.y is every time different (vertex where ball contact the ground). I don't understand why onCollisionPositionChangeObservable : Observable<Vector3> An event triggered when the collision's position changes Are this functions for Mesh or Mesh's collider? Any example playground will be good to learn us how to use this callback functions. Doesn't work. Or I don't know how to use this method/funciton of API. What is going on with this callback functions? I try debug but functions are not called. I think we should do like (we define our callback function which it should invoked) perplexus.onCollisionPositionChange = new function(vertex) { // here we should get vertex (x,y,z) of point where ball collide with perplexus console.log( vertex ); } Is this onCollisionPositionChangeObserve function implemented and does it work? If this will work it will be perfect solution. What am I doint wrong??? Can anybody help us to understand this three functions? I would like to made custom auto align FreeCamera (I am experimenting) and I need vertex=contact of Sphere and Perplexus for each frame. Is there any another way to obtain vertext where two meshes touch each other ------------- // I'am trying this but, // callback functions don't invoke ????? perplexus.onCollisionPositionChange = function(vertex) { console.log("Test"+ vertext+" "+this); } perplexus.onCollisionPositionChangeObservable = function(vertex) { console.log("Test1"+ vertex); } perplexus.onCollide = function() { console.log("Test1"+this); } JohnK Thanks for your help. Is BabylonJS capable to achive that with BabylonJS's APIs? Or should we hack math like JohnK is doing?@RaananW@Deltakosh Greetings Ian Quote Link to comment Share on other sites More sharing options...
ian Posted February 6, 2017 Author Share Posted February 6, 2017 Ok I solve problem. But I still would like to see any example code around those functionsonCollisionPositionChange onCollisionPositionChangeObservable onCollide 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.