ragingclaw Posted September 28, 2016 Share Posted September 28, 2016 Hello BJS sorcerers, I am in need of your voodoo once again! I am using an arcRotateCamera. I have some hidden boxes that I am using as colliders the camera can pass through. Here is the lowdown: camera is outside of the party box camera is inside the party box so it makes a little love, does a little dance, and gets down tonight and sends a message to angular "im at the party" (true) camera leaves the party box. stops with the love making, no more dancing - it only cries itself to sleep, and sends a message to angular "i left the party" (false) I am using .onCollide to detect the collisioins between the camera and other stuff. The hidden boxes do have checkCollisions = true; I get the logs for the true event, but I never get false. some code for you to laugh at: scene.executeWhenReady(function() { _scene.collisionsEnabled = true; var cam = _scene.activeCamera; cam.collisionRadius = new BABYLON.Vector3(1, 1, 1); cam.checkCollisions = true; cam.onCollide = function(collidedMesh) { if (collidedMesh.obj_type == "locations") { cameraAtLocation = true; console.log('cameraAtLocation', cameraAtLocation); } else { cameraAtLocation = false; console.log('cameraAtLocation', cameraAtLocation); } }; }; so to recap, I need to know when the camera leaves the collision if that makes sense. Thanks you wonderful people! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 28, 2016 Share Posted September 28, 2016 Unfortunately there is an event for collisionEnter but not for Exit. I suggest checking on every frame is mesh.intersects(otherMesh) Quote Link to comment Share on other sites More sharing options...
ragingclaw Posted September 28, 2016 Author Share Posted September 28, 2016 can the camera be used like that though? is it considered a mesh? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 28, 2016 Share Posted September 28, 2016 Nope but you can still try to impersonate it with an attached sphere for isntance (Collision engine uses an ellipsoid) Quote Link to comment Share on other sites More sharing options...
ragingclaw Posted September 28, 2016 Author Share Posted September 28, 2016 ahhh i can give that a shot. i will report back GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted June 27, 2017 Share Posted June 27, 2017 @RaananW In your latest collision code, when collision with camera is detected, the camera will reposition itself to a new position (a mix between previous position and constraints). But if someone wants to let the camera go through objects and just receive a notification (as ragingclaw), is it possible? EDIT: This question could be linked to 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.