SebRomeo Posted February 20, 2017 Share Posted February 20, 2017 Hi guys I've tried a lot but can't find any solution. Also I try to find in documentation which is not very detailled for the moment about physics behavior but doesn't find an answer... I use oimo.js and when I try to enable physics on a child element it bring me the error : "TypeError: e.physicsBody is undefined"... I may use onCollide but I can't find any ressource on it's behaviour and intersectMesh....but as I have to do it with hundred of object I wonder if there is a different approch than a "brute force" testing of all intersect mesh with all others ( approx. 10 000 test each frame ) Thanks a lot Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 21, 2017 Share Posted February 21, 2017 Hiya SR! First, that error has been seen in CannonJS, too. Even though it is annoying, I think it can be ignored, for now. No impact to physics operations have been seen so far, caused by that error report. BUT... it could be related to the ORDER that the physics impostors are added to parent/children. You should probably read this thread. It does some talking about the ORDER of impostor-adding.... when dealing-with parent/child compounding. This badly built Oimo document might be of some help, too.... for advanced OIMO learning/hacking. (I don't wish that on anyone) ("native" calls are scary!) And... lastly, we have seen SOME indications that... it is un-wise to scale a mesh that will be used as a physics parent. By using the meshBuilder system of creating basic mesh, you can set some mesh size/scale dimensions... without needing to use .scaling. Scaling, rotation, and position are handed-down from parent to children, and this is how it could be related to the "order of adding impostors". I'm no expert, and docs are introductory level, so far (but thank goodness and Raanan for those, too). Perhaps you can help us with advanced physics docs, in the future? Don't forget playground searching, too. Hope this helps. SebRomeo and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
SebRomeo Posted February 21, 2017 Author Share Posted February 21, 2017 Man !! A big thank you for answer ! The thread seems to point this exact problem I tried everything, and you are true, that in cannon it doesn't work too.. Also, I'll be glad to help for all that when I know more about it, I very find that framework revolutionnary and a very good in the concept, tools and community but as it is fresh new, there is still work to achieve. Thanks for all your contribution Wingnut 1 Quote Link to comment Share on other sites More sharing options...
SebRomeo Posted February 22, 2017 Author Share Posted February 22, 2017 Just to give the solution that worked for me : Creating Childs before Parents as solved the issue for me ! /* Create child sphere */ var sphereChild = BABYLON.Mesh.CreateSphere("spherechild", 16, 1, scene); sphereChild.position.y = 1; sphereChild.position.x += .1; sphereChild.physicsImpostor = new BABYLON.PhysicsImpostor(sphereChild, BABYLON.PhysicsImpostor.SphereImpostor, {mass: 2}, scene); /* then create the parent sphere */ sphere.physicsImpostor = new BABYLON.PhysicsImpostor(sphere, BABYLON.PhysicsImpostor.SphereImpostor, {mass: 2}, scene); /* then add relationship */ sphereChild.parent = sphere; GameMonetize and Wingnut 2 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.