Jump to content

Getting a bit of stutter on moveWithCollisions ocassionally


Recommended Posts

Not so much a performance drop, but a weird correction. http://projects.agmprojects.com/topdown/ Use WASD to move around, left click the mouse to shoot at the red guys chasing you. Anyways, when moving along the plane, one might see the occasional stutter of the yellow cube. I am not sure why this is happening. The plane is flat, so i'm confused what would cause a mishap like that.

Link to comment
Share on other sites

Hi again, AGM!  Looks like a fun game is being built, there.


Sometimes the yellow cube just stops... and you need to do a little move in another direction before continuing.  And sometimes I see the stutters happening in the same locations... and repeatable.  I think collisions are causing the stutter.  You might try to monitor for collisions by turning the cube a different color whenever it collides with something.  That way, if the cube changes color when a stutter happens, you know that it was a collision that caused it  (and thus target your troubleshooting in THAT area).


I'm going to guess.  (What's new?)  :)  I suspect... that the cube's ellipsoid is dragging on the ground.  Just for fun, you might want to try cube.ellipsoidOffset = new BABYLON.Vector3(0, 0.1, 0);   ... in your game_scene.js .addCube function.  That SHOULD bring the collision ellipsoid off the ground a tiny bit.


Or maybe try this... cube.ellipsoid = new BABYLON.Vector3(0.5, 0.9, 0.5);.  I think that will shrink the collision ellipsoid's height just a bit (which will maybe lift the ellipsoid off the ground, depending upon cube height). 


Smarter people than I... will soon be here to help.  I know for a fact that Dad72 is an ellipsoid collision EXPERT!  (He's pretty hot on a bunch of other subjects, too.)


But, if your scene uses gravity, maybe the collision ellipsoid is going to fall to the ground whether it is smaller or offset.  And that will cause the ground-dragging to continue and the problem to still happen.  *shrug*


But why 'intermittent' colliding (if that's what's happening)?  *scratch scratch*  It's obvious that the collision ellipsoid is not dragging on the ground constantly, or else one would think that WASD would not work at all. 


Interesting.  Sorry I couldn't be of more help.  Good luck.  Report discoveries if you'd be so kind.  Thanks!


PS: Is that a Fender you're holding?  I love pickin'.  Been doing it forever, now.  Yourself?

Link to comment
Share on other sites

I agree with wingnut, adjust: cube.ellipsoid & cube.ellipsoidOffset. The problem can only come from there.

I tend to always put my characters slightly above the ground and apply the severity of ways that never ellipsoid is underground. gravity raises the ellipsoid on the ground as well.
Link to comment
Share on other sites

Thx D72!  Sometimes it seems that we need two ellipsoids... one for gravity-stop, and one for after-gravity collisions.


For example, let's pretend that AGM's yellow cube... falls from a height of 2 units... when the game first starts.  It lands on the ground due to -Y gravity, and stops with its ellipsoid barely touching the ground, right?  As long as gravity remains turned-on, the ellipsoid will ALWAYS be barely touching the ground, right?


Or is that what mesh.ellipsoidOffset is supposed to fix?  Does a cube.ellipsoidOffset = new BABYLON.Vector3(0, 0.1, 0); make the cube's MESH sink into the ground?  That would cause the ellipsoid to again be touching the ground, yes?  (thx for insight)

Link to comment
Share on other sites

Thanks for your replies. In debugging this and messing with the ellipsoid values, is there a way to show the elliposid with the 2.0 debug layer?


Here's what i have currently for the player's mesh:


this.mesh.ellipsoid = new BABYLON.Vector3(0.5, 0.9, 0.5);this.mesh.ellipsoidOffset = new BABYLON.Vector3(0, 1, 0);

Still acts a little funny though.


One other thing a friend of mine noticed, if you switch on wireframes, you'll see the vertices in the ground. Go a bit below so you can see the diagonal one on screen. Aim the mouse towards it. The laser meshes will stop and slide up the line instead of going through it. Probably another ellipsoid bug on my part. But i find it interesting.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...