burbonvagin Posted August 14, 2014 Share Posted August 14, 2014 I'm trying get mesh.movewithcollisions working, and I'm not sure why the player sphere is partially intersecting the sphere and the plane. I have some physics in the scene, but turning them off doesn't change the result. html: http://jesseolsson.github.io/bug_movewithcollisions/javascript: http://jesseolsson.github.io/bug_movewithcollisions/index.js Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 14, 2014 Share Posted August 14, 2014 moveWithCollisions does not use the physics. You must use an elipsoide as with the freecamera and enable the collision on objects. see : https://github.com/BabylonJS/Babylon.js/wiki/09-Cameras-collisions => 4 - Object vs. object collision burbonvagin 1 Quote Link to comment Share on other sites More sharing options...
burbonvagin Posted August 15, 2014 Author Share Posted August 15, 2014 thanks! how do you simulate gravity on a character like this? do you just move it down until he intersects a mesh, or is there a better way? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 15, 2014 Share Posted August 15, 2014 scene.gravity = new BABYLON.Vector3(0, -0.15, 0);If use you an elipsoid it receive the gravity burbonvagin 1 Quote Link to comment Share on other sites More sharing options...
burbonvagin Posted August 15, 2014 Author Share Posted August 15, 2014 that sounds awesome, but I can't get it to work. https://33fbbfe7efe608e329702f900dfc06fc804016bb.googledrive.com/host/0BzDfAgmFmMswMWdkenBneEFWRVE/mirror_for_junior2/ Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 15, 2014 Share Posted August 15, 2014 The cube uses the gravity of the scene, require:cube.applyGravity = true;and that the cube does not fall through the ground, require:plane.checkCollisions = true;have you read this tutorial here: https://github.com/BabylonJS/Babylon.js/wiki/09-Cameras-collisionsEverything is written on the gravity and collisions Quote Link to comment Share on other sites More sharing options...
burbonvagin Posted August 15, 2014 Author Share Posted August 15, 2014 i can easily get it to work with the camera, like the tutorial shows. I can't get it to work with a mesh though. I think I added all the properties here: https://33fbbfe7efe608e329702f900dfc06fc804016bb.googledrive.com/host/0BzDfAgmFmMswMWdkenBneEFWRVE/mirror_for_junior2/ Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 15, 2014 Share Posted August 15, 2014 In your Vector3, you put 0 on the Y position, which has the effect of leaving your object's position or you put it on its height "2" => cube.position = new BABYLON.Vector3(0, 2, 0) if you made -0.1, it'll work. cube.moveWithCollisions (new BABYLON.Vector3 (0,01, -0.1, 0)); burbonvagin 1 Quote Link to comment Share on other sites More sharing options...
burbonvagin Posted August 15, 2014 Author Share Posted August 15, 2014 thanks Quote Link to comment Share on other sites More sharing options...
burbonvagin Posted August 15, 2014 Author Share Posted August 15, 2014 this is a replacement for gravity though, right? because when i turn off gravity it still works. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 15, 2014 Share Posted August 15, 2014 I think scene.gravity is for camera, or it may be a bug? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 16, 2014 Share Posted August 16, 2014 scene.gravity is only for camera collisions Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 16, 2014 Share Posted August 16, 2014 Thanks for the confirmation, this is what seemed to me 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.