satguru Posted November 4, 2017 Share Posted November 4, 2017 see https://www.babylonjs-playground.com/indexstable#97B3B7#12 Here I have 2 boxes box1 and box 2. box1 is way above box2 I move box2 down by 1m using moveWithCollision(). I print the before and after position on console. Everthing works as expected. But now if i turn on collision on box1 (uncomment line 21), box2 does not move !! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 6, 2017 Share Posted November 6, 2017 Hello, you just need to compute world matrix for box1 if you want to do the move without waiting for a render: https://www.babylonjs-playground.com/indexstable#97B3B7#13 Quote Link to comment Share on other sites More sharing options...
satguru Posted November 6, 2017 Author Share Posted November 6, 2017 Thanks. Keep forgetting about compute world matrix Here is another issue though Now I am trying to move box1 down towards box2 by 0.25m Gap between them is 1m. But box1 does not move down at all. Infact it moves up by 0.01. https://www.babylonjs-playground.com/indexstable#97B3B7#15 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 6, 2017 Share Posted November 6, 2017 Remember that meshes are using the ellipsoid property to define their impostor when using collisions Quote Link to comment Share on other sites More sharing options...
satguru Posted November 6, 2017 Author Share Posted November 6, 2017 Yes I was wondering about the ellipsoid property. Can you clarify few points below? a. In the above example the gap between the boxes is 1m. Does box1's ellipsoid extends outside the box1 bounding box by 1m? b. If I move box1 with moveWithCollision then I am assuming the collider system uses its ellipsoid as the impostor. But what about box2? It is NOT being moved by moveWithCollision? Does the collider system uses its ellipsoid too or does it use its bounding box as impostor? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 6, 2017 Share Posted November 6, 2017 Collision system only uses ellipsoid on the caller (so only on box2 hereif you call moveWithCollisions on box2) So : a. by default the ellipsoid is 0.5,1,0.5 so 1m from the center of the box1 on every side which leads to a 2m height ellipsoid centered on the box b. Correct. box2 is used directly (the vertices are used) Quote Link to comment Share on other sites More sharing options...
satguru Posted November 7, 2017 Author Share Posted November 7, 2017 Regarding a. If the height of the ellipsoid is 2m and is centered on the box and height of the box is 1m then that means the ellipsoid should only extend 0.5m outside the box, at the top and bottom. That means the gap between the bottom of box1's ellipsoid and top surface of box2 is 0.5m. Should I not be able to move the box1 down by atleast 0.25m? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 7, 2017 Share Posted November 7, 2017 Sure but you need to center the ellispoid on the box: https://www.babylonjs-playground.com/indexstable#97B3B7#16 by default it uses 0,0,0 as origin Quote Link to comment Share on other sites More sharing options...
satguru Posted November 8, 2017 Author Share Posted November 8, 2017 Sorry to be a bother but I still don't get it. I do not see why we have to move the ellipsoid up by 1m. As you can see from, my very professionally drawn, sketch below there is already a gap of 0.5 meter between the ellipsoid and box2. What am I missing? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 8, 2017 Share Posted November 8, 2017 No worry Initially ellipsoid based collision was made for the FreeCamera to simulate FPS. In this mindset, the ellipsoid is positioned to have his top aligned with the camera top (as you expect the camera to be the eyes of the player) Based on this assertion, all ellipsoids are created like this: So in your case you need to move it up by 1 (as the ellipsoid is 2 units tall) Quote Link to comment Share on other sites More sharing options...
satguru Posted November 9, 2017 Author Share Posted November 9, 2017 So if I move the ellisoid up by 1m I should then be able to move box1 down by 1 m. But that does not happen. It only moves down by 0.5m. See https://www.babylonjs-playground.com/indexstable#97B3B7#17 So it would seem the ellipsoid is positioned as follows The top of the ellipsoid at the center of mesh? And thanks for indulging all my questions. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 9, 2017 Share Posted November 9, 2017 @satguru & @Deltakosh Stange indeed, when the ellipsoid is default y 1 and ellipsoidOffset y is also 1 so center of ellipsoid is at box1's top and bottom of ellipsoid is at box1's bottom, it isn't working as your PG displays, If you change both values to .5, so center of ellipsoid is at box1's center and bottom of ellipsoid is still at box1's bottom it works..https://www.babylonjs-playground.com/indexstable#97B3B7#18 something does seem fishy Arte 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 9, 2017 Share Posted November 9, 2017 @satguru yeah you are right actually. The goal is still to represents a head initially. So your schema is correct This may require a bit of documentation Quote Link to comment Share on other sites More sharing options...
satguru Posted November 10, 2017 Author Share Posted November 10, 2017 @Deltakosh nice. Have few more questions but will ask them in the question forum. Thx @aWeirdo Not fishy anymore When you make ellipsoid.y=0.5, you are changing the ellipsoid height to 1m (same as that of box) and when you make ellipsoidOffset.y = 0.5 you move the ellipsoid's top to the top of box thus moving the ellipsoid completely inside the box Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 10, 2017 Share Posted November 10, 2017 @satguru What i ment is fishy, is when both values are 1, the bottom of the ellipsoid should also align with the bottom of box1, as it does when the values are 0.5 But in your PG, box1 cannot be moved down on top of box2 like you can when the values are 0.5 Quote Link to comment Share on other sites More sharing options...
satguru Posted November 11, 2017 Author Share Posted November 11, 2017 @aWeirdo Nicely drawn Based on the above discussion the offset is the distance of ellipsoid top from mesh center So aWeirdo 1 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 11, 2017 Share Posted November 11, 2017 @satguru Ahh i missed that, Okay, that makes sense 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.