Search the Community
Showing results for tags 'ellipsoid'.
-
Hi, I saw the code presented in the link https://playground.babylonjs.com/#1NQTNE#11 and played many times. I felt "moveWithCollisions" is full of magic . it seems that with the help of "movewithCollisions" the mesh can smartly move and move little by little and finally manage to find its path to reach its destination. I checked the code but was not able to figure out how to use it exactly, there is few comment or remarks to tell what's the purpose of some important lines . so I listed these important lines that I didn't understand as below. can anyone please help to explain what's the purpose of these critical lines? (please notice that I use "//" to bring up what my question is ) // move to clicked coordinates ............ if(meshPlayer.destination) { var moveVector = meshPlayer.destination.subtract(meshPlayer.position); if (moveVector.length() > 1.1) { //1.why use 1.1 ,other than 2.2 or 0.8 or any length else? is it related to the player size 1 while downcasting a ray ? moveVector.y = GRAVITY; //2.GRAVITY is -0.5 as defined earlier, but why moveVector.y must be -0.5? what's the purpose to assign moveVector.y ? moveVector = moveVector.normalize();//3.what's the purpose of "normalize"?what's the benefit of doing this? is this line mandatory? moveVector = moveVector.scale(0.2); //4.why to shrink the moveVector to 1/5 of its original size? why not 0.1 or 2 or some number else? if(meshFound.distance > 1.1){moveVector.y = GRAVITY;} //5.why 1.1 again? meshPlayer.moveWithCollisions(moveVector); } else { meshPlayer.destination = null; } } .......... It's really appreciated for your time. Edit Your content will need to be approved by a moderator
-
- avoid obstables
- subtract
- (and 5 more)
-
Hi, Simple demo of the problem - http://www.babylonjs-playground.com/#MJRGPB Try to move to the box from the front or side - camera's ellipsoid (with size 1.5) works as expected. Now try to move to the box from below - you can go a little inside the box and see the internals. You can notice that camera's ellipsoid from above is missing or it's size is 0. According to this - https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity - ellipsoid should be symmetrical. Is this fixable? Bug exists only when moving from below the box. UPDATE Another funny thing is with planes - http://www.babylonjs-playground.com/#MJRGPB#1 ... when moving through it from one side - there are normal collisions, but from another - you are able slowly go through it like something is wrong with collisions detection.
- 52 replies
-
- camera
- collisions
-
(and 1 more)
Tagged with:
-
solved How to dispose ellipsoid in moveWithCollisions
brucewong21 posted a topic in Questions & Answers
So a gotcha of the moveWithCollisions method is that it uses an ellipsoid mesh to calculate collisions of your mesh instead of the original mesh dimensions. I see a clear way to remove your original mesh but how do we remove the ellipsoid mesh from the scene? I'm worried that keeping these ellipsoids even when my original mesh has been disposed of will hurt performance. Thank you so much. -
Hello, I'm currently building a scene where a person walks through a room. There are several objects in the room. When I run and run against a large mesh, I collide and can't get through (it's wanted). When I walk towards a low (low height) mesh, I'm suddenly reset, probably to the old position. Camera position: [0.1.2, -2.25] Camera ellipsoid: [0.5,0.59,0.5] Scene gravity: [0, -9.81, 0] Bottom is at y = 0 How do I set the camera's collisionsbox correctly to run on the floor and not get the effect of low meshes? Thank you.
-
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 ?
-
How do we define the size of our collision box (i goes would be the same for camera and physics)... Do we use mesh.ellipsoid and mesh.ellipsoidOffset to actual define our collision bound box ??? Don't seem to see a mesh.collisionRect or anything like that. I am trying to emulate the BOX and CAPSULE collider functionality in unity where you drag the "collider rect" to define size of collision box or capsule. I would then like to store those values on my node.metadata and use those to "DEFINE" the babylon.mesh collision rect