hulahula Posted May 6, 2018 Share Posted May 6, 2018 Hello I found one bug I think. In this exampel https://www.babylonjs-playground.com/#KNE0O#4 I found this example o https://doc.babylonjs.com/babylon101/raycasts ray.show(scene, new BABYLON.Color3(1, 1, 0.1)); When I tried this code, which was prepared in exampel then babylon.js stop worked. Sorry for my poor english. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted May 6, 2018 Share Posted May 6, 2018 You must use a RayHelper now. I had reported it a long time ago, and this has never been corrected (Or it was forgotten). I will send the fix. let rayHelper = new BABYLON.RayHelper(ray); rayHelper.show(scene); https://www.babylonjs-playground.com/#KNE0O#83 hulahula 1 Quote Link to comment Share on other sites More sharing options...
hulahula Posted May 6, 2018 Author Share Posted May 6, 2018 Thank you very much @Dad72 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted May 6, 2018 Share Posted May 6, 2018 @Alenvei So you can put the subject in *solved* ? The fix was send, it should be validate soon. hulahula 1 Quote Link to comment Share on other sites More sharing options...
hulahula Posted May 6, 2018 Author Share Posted May 6, 2018 @Dad72 I have one question for you I am making littel "Space-RPG" and question is : Can I make 2 imported obj in ma game like for exampel player and door intersect with raycast (raycast is a part of the player ) if i using this mathod : if (rayCast.intersectsMesh(door, true)) { console.log("open"); } else { console.log("closed"); } I have littel problem whit it ? it doesn't register intersection Quote Link to comment Share on other sites More sharing options...
Dad72 Posted May 6, 2018 Share Posted May 6, 2018 IntersectMesh is for meshes that detects another one. Your code here will not work, I think. You have to do something like if (character.intersectsMesh(door, true)) { console.log("open"); } else { console.log("closed"); } Quote Link to comment Share on other sites More sharing options...
hulahula Posted May 6, 2018 Author Share Posted May 6, 2018 I understend @Dad72.. so raycast can´t pick only specific obj ? for exampel : only doors in room with lot of other obj in it Quote Link to comment Share on other sites More sharing options...
Dad72 Posted May 6, 2018 Share Posted May 6, 2018 If you use RayCast you do not need IntersectMesh : Your ray code ... var hit = scene.pickWithRay(ray); if (hit.pickedMesh){ var mesh = hit.pickedMesh; console.log("open the door"); } Quote Link to comment Share on other sites More sharing options...
Dad72 Posted May 6, 2018 Share Posted May 6, 2018 You can also do in the condition if (hit.pickedMesh.name == "door"){ console.log("open the door"); } else { console.log("close the door"); } hulahula 1 Quote Link to comment Share on other sites More sharing options...
hulahula Posted May 6, 2018 Author Share Posted May 6, 2018 Thank you again @Dad72 Yes your second exampel worked for me Quote Link to comment Share on other sites More sharing options...
Dad72 Posted May 6, 2018 Share Posted May 6, 2018 You're welcome 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.