Dad72 Posted March 22, 2016 Share Posted March 22, 2016 How can we stop collisions? I would only use gravity physics and prevent collisions. setCollision(true || false) for exemple. true by default. it's possible ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 22, 2016 Share Posted March 22, 2016 hey do you mean physics collisions? If you just want gravity, I guess it will be easier to just move every object by a given vector on every frame Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 22, 2016 Author Share Posted March 22, 2016 Yes for the phisics collisions. The problem is that I use physics so that when I add an object on the stage with my editor, it is positioned on the ground, but if I move an object with the transform gizmo and it hits another object it found that eject as a bowling pin. I therefore wish to disable the collision of physics that is useful to me as an object does not receive the physical collisions. The soil itself should continue to receive collisions. So what I need is to disable physical collision objects. If I need a video can do in soirer or tomorrow. Thanks Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 22, 2016 Share Posted March 22, 2016 You can turn off physics for the object you want to manipulate by settings its impostor to null and then restore it Or other idea: keep physics on and let the user move the objects around with physics constraints Dad72 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 22, 2016 Share Posted March 22, 2016 Hi dad, there is a way to disable objects from colliding into one another using cannon js: http://www.babylonjs-playground.com/#A2WGF#1 , notice line 30 which disables collisions. Contact will be created, but will be ignored. This way only gravity (and other forces like impulses and velocity) will be taken into account. You can choose which body has collisions and which doesn't. There is also a way to filter which bodies collide with the others, but this is a native cannon thing, I might write about it in the future. Oh, and don't forget, this is a cannon feature. changing the engine to Oimo won't work anymore (one of the functionalities I still haven't united between the two) Dad72 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 22, 2016 Author Share Posted March 22, 2016 Thank you for ideas. it seems to me good solution that I will try to see the best. By cons I am not sure I understood your second solution DK with physics constraints. A small example would help me understand better. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 23, 2016 Author Share Posted March 23, 2016 This does not work as expected I think. I would like on the ground collision is enabled and the collision is off 2 spheres collide for example. On this PR, I activate the collision as you Raanan and offers on the sphere I disable. But the sphere having no collision happens when even through the ground. In this case, I think the solution of 2 Deltakosh could be interesting, but I did not really understand. It should I prevents two object to be ejected into contact with each other. http://www.babylonjs-playground.com/#A2WGF#2 Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 23, 2016 Share Posted March 23, 2016 Hi dad72, to do that you will have to use cannon's collision groups and masks: http://www.babylonjs-playground.com/#A2WGF#3 just a note, the collision group and mask are not indices, they are binary operations. 1 in binary = 0001, 2 in binary - 0010 , so it works. but with 3 i(0011 in binary) it might not work as expected. Not a lot of time to explain, but I hope this will get you further. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 23, 2016 Author Share Posted March 23, 2016 Yes, it's perfect Raanan. Thank you for you help. dbawel and RaananW 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.