Alex10 Posted December 11, 2015 Share Posted December 11, 2015 I want to have a camera (the player) does not go beyond the stage. So I applied checkcollision on skybox. But it was used outside Cuba behind the scenes and inside the camera falls down from the edge of the stage.var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(80, 5, -10), scene);camera.setTarget(BABYLON.Vector3.Zero());camera.ellipsoid = new BABYLON.Vector3(2, 2, 1);camera.checkCollisions = true;camera.applyGravity = true;// Skybox var skybox = BABYLON.Mesh.CreateBox("skyBox", 390.0, scene); var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene); skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("/skybox", scene); skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; skybox.material = skyboxMaterial; skybox.checkCollisions = true; Quote Link to comment Share on other sites More sharing options...
RaananW Posted December 11, 2015 Share Posted December 11, 2015 Collision detection is using the normals of the box/sphere of the skybox, which are pointing outwards. One way is to invert all normals. The other is, if it's a box, to build invisible collision walls that are positioned where the skybox is. Quote Link to comment Share on other sites More sharing options...
Alex10 Posted December 12, 2015 Author Share Posted December 12, 2015 Somewhere there are examples "invert all normals"? Quote Link to comment Share on other sites More sharing options...
RaananW Posted December 12, 2015 Share Posted December 12, 2015 Inverting the normals has other consequences that you might need to handle. Light will reflect differently, for example. Technically it is done like this - http://www.babylonjs-playground.com/#1MMWXU#1 . I still need to debug exactly why it isn't working correctly - just another reason to simply create walls :-) Quote Link to comment Share on other sites More sharing options...
Alex10 Posted December 15, 2015 Author Share Posted December 15, 2015 But if I run this example, the arrow, the camera goes abroad skybox !https://www.dropbox.com/s/jh1px6a7b20mim6/123.png?dl=0 Quote Link to comment Share on other sites More sharing options...
RaananW Posted December 15, 2015 Share Posted December 15, 2015 yep, as I said - I still need to debug exactly why it isn't working correctly - just another reason to simply create walls :-)Don't trust normal inversion. Create walls, invisible walls. It will be better. Alex10 1 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.