getzel Posted February 26, 2017 Share Posted February 26, 2017 Hello guys ! http://www.babylonjs-playground.com/#1E3DCH#2 I do some experiments with the native function moveWithCollision and the ellipsoid parameter for meshes. I don't know what dimension should be the ellipsoid here or the ellipsoid offset. Our character is the red man and the obstacle is the blue box. The character should collide with the obstacle. I want to test collisions with man on the floor and box at different y positions : box on the floor (collision), floating box in front of man (collision), floating box upside the man (no collision) When box is on the floor, it's ok. There is a problem when the box is floating in front of the man (in the PG), because the man doesn't stop. If I change the ellipsoid number Y from 2.0 to 2.5, the man will be floating with strange collision and I want that the man stays on the floor. Offset is for moving the ellipsoid from the center of the mesh ? So I don't need it here ? Can we implement a function to draw the ellipsoid ? Quote Link to comment Share on other sites More sharing options...
Temechon Posted February 26, 2017 Share Posted February 26, 2017 Drawing the ellipsoid, with totally empiric values : http://www.babylonjs-playground.com/#1E3DCH#4 getzel 1 Quote Link to comment Share on other sites More sharing options...
getzel Posted February 26, 2017 Author Share Posted February 26, 2017 Thank you a lot for this function. So now we see the ellipsoid : http://www.babylonjs-playground.com/#1E3DCH#5 But there is still the problem : the man can go through the floating box. Although if we set the box on the floor with position.y = 2, the collision works. Quote Link to comment Share on other sites More sharing options...
getzel Posted February 28, 2017 Author Share Posted February 28, 2017 Who made this function moveWithCollision ? Quote Link to comment Share on other sites More sharing options...
RaananW Posted March 1, 2017 Share Posted March 1, 2017 This seems to be because of the size of the ellipsoid. Making it bigger on the y axis - http://www.babylonjs-playground.com/#1E3DCH#7 solved the collision. Need to check why it didn't work with the original value Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 1, 2017 Share Posted March 1, 2017 On 28/02/2017 at 2:12 AM, getzel said: Who made this function moveWithCollision ? This function was added by DK. I had asked this functionality to move a character without using physics. I thank again Dk for this function. Quote Link to comment Share on other sites More sharing options...
getzel Posted March 1, 2017 Author Share Posted March 1, 2017 @RaananW The problem now is that the man is floating, not on the floor. We can change the ellipsoid offset but I guess it's not the best practice ? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 1, 2017 Share Posted March 1, 2017 1 hour ago, getzel said: We can change the ellipsoid offset but I guess it's not the best practice ? This is what you must do. this is why offset is made. Quote Link to comment Share on other sites More sharing options...
getzel Posted March 3, 2017 Author Share Posted March 3, 2017 But the ellipsoid should be at the center of the mesh by default, no ? @Deltakosh Can you take a look ? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 3, 2017 Share Posted March 3, 2017 Yes it's true. I think it depends on the pivot points of the object. "offset" the blow to reposition the ellipsoid. I admit I also have a little difficulty with that. and the function to see above ellipsoid is very misleading because it does not correspond in some cases the actual size of the elipsoid. getzel 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 3, 2017 Share Posted March 3, 2017 This is the case. By default the ellipsoid is centered on your box. Which seems to be the case here. The problem here is that the ellipsoid is not ideal to represent a box. Hence the need to offset it a bit to accommodate the shape difference, Quote Link to comment Share on other sites More sharing options...
getzel Posted March 4, 2017 Author Share Posted March 4, 2017 Now you can move pressing any key. Yes it doesn't work with a centered ellipsoid : http://www.babylonjs-playground.com/#1E3DCH#8 the collision tests first the lower part ? Instead it works with a bigger ellipsoid offseted : http://www.babylonjs-playground.com/#1E3DCH#13 I updated the drawing function for offset. We could implement it in the BJS sourcecode. Maybe it's better to have a bounding box than an ellipsoid for the collision testing on the character ? Because the ellipsoid is not so accurate. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 6, 2017 Share Posted March 6, 2017 The whole collision engine is designed around the ellipsoid so changing it is impossible. 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.