Jump to content

moveWithCollisions not work


Cris
 Share

Recommended Posts

hi all,

I use BABYLON.SceneLoader to load a maze scene with many walls, and also import a spider robot  to this scene. But when I want to use moveWithCollision method to control robot moving, it's not work. Robot will cross the wall and not detect collision.

If I create a scene manually and create many box instead of walls, the moveWithCollision method has worked.

I'm sure all wall's checkCollisions property is true...kindly suggest me for this

Link to comment
Share on other sites

2 hours ago, Cris said:

hi all,

I use BABYLON.SceneLoader to load a maze scene with many walls, and also import a spider robot  to this scene. But when I want to use moveWithCollision method to control robot moving, it's not work. Robot will cross the wall and not detect collision.

If I create a scene manually and create many box instead of walls, the moveWithCollision method has worked.

I'm sure all wall's checkCollisions property is true...kindly suggest me for this

Hi Cris,

Can you post a playground scene? i know you're importing a scene... (from blender maybe?)...but if you have the exported file on github, you can easily use the raw github url to import it into the playground.. http://www.babylonjs-playground.com/#1UQADD#0

wrote a brief tutorial on getting your assets to show in the playground  https://github.com/3dwebgs/miscWebGLpages/blob/master/babylondoc.md

Even if you don't use git, you can still create a github account, its convenient for so many things. The best way you can help yourself here is to get some practice getting your code into a playground scene, so you can demonstrate your question to the forum. It helps everyone else help you by seeing your code.

Link to comment
Share on other sites

18 minutes ago, webGLmmk said:

Hi Cris,

Can you post a playground scene? i know you're importing a scene... (from blender maybe?)...but if you have the exported file on github, you can easily use the raw github url to import it into the playground.. http://www.babylonjs-playground.com/#1UQADD#0

wrote a brief tutorial on getting your assets to show in the playground  https://github.com/3dwebgs/miscWebGLpages/blob/master/babylondoc.md

Even if you don't use git, you can still create a github account, its convenient for so many things. The best way you can help yourself here is to get some practice getting your code into a playground scene, so you can demonstrate your question to the forum. It helps everyone else help you by seeing your code.

Thank you for your help!

Forgive me careless, here is my demo. My scene model is export from blender.

http://www.babylonjs-playground.com/#1UQADD#2

press key 'z' to move cube

Link to comment
Share on other sites

Hey Cris... try this one...

http://www.babylonjs-playground.com/#1UQADD#4

Line 39 area.  You forgot to set .checkCollisions on the player itself.  Everything else... was perfect... and I had a few minutes of fun driving around Mister Box.  Successful game by Cris... #1.  Many more to come, I predict.  Hope this helps.

Link to comment
Share on other sites

Thx, but... whomever wrote this "BJS" engine... made it easy.  i know the guy a little... he taught me about keeping things out-of continuous collision, taught me about ellipsoid sizing, taught me about... oh, just a ton of stuff about the BJS built-in collision system.

He's a great guy... I'll introduce him to you, someday.  ;)  I think he's from Texas. heh

Link to comment
Share on other sites

13 hours ago, Wingnut said:

Hey Cris... try this one...

http://www.babylonjs-playground.com/#1UQADD#4

Line 39 area.  You forgot to set .checkCollisions on the player itself.  Everything else... was perfect... and I had a few minutes of fun driving around Mister Box.  Successful game by Cris... #1.  Many more to come, I predict.  Hope this helps.

Thank for your help! I have fixed my bugs!

Link to comment
Share on other sites

:) Good deal.  Our pleasure.

I did some more experiments on your scene.

http://www.babylonjs-playground.com/#1UQADD#5

I added a green sphere... so I could "see" the meshPlayer.ellipsoid... trying to test some things.  Not sure what I broke or how it is broken, but I broke something.  :)

Lots of reporting to console... checking meshPlayer.ellipsoid sizes.  Numbers look good, but... player nav has troubles.

Green sphere falls too deep into floor, and player goes under walls, etc.  Just a mess.  Way to go, Wingnut!  :)

Link to comment
Share on other sites

5 hours ago, Wingnut said:

:) Good deal.  Our pleasure.

I did some more experiments on your scene.

http://www.babylonjs-playground.com/#1UQADD#5

I added a green sphere... so I could "see" the meshPlayer.ellipsoid... trying to test some things.  Not sure what I broke or how it is broken, but I broke something.  :)

Lots of reporting to console... checking meshPlayer.ellipsoid sizes.  Numbers look good, but... player nav has troubles.

Green sphere falls too deep into floor, and player goes under walls, etc.  Just a mess.  Way to go, Wingnut!  :)

Actually, I found that if two mesh that has been set checkCollisions property to true overlap together, the moveWithCollision function will not work.

In my first example, the cube has overlaped with ground too.

Or did I missed something ?

Link to comment
Share on other sites

On 9/19/2016 at 11:18 PM, Cris said:

Thank you for your help!

Forgive me careless, here is my demo. My scene model is export from blender.

http://www.babylonjs-playground.com/#1UQADD#2

press key 'z' to move cube

No worries, Just wasn't sure if you knew how to get a blender export in the playground. Glad you're getting it figured out, thats the best feeling.

On 9/20/2016 at 9:59 AM, Deltakosh said:

@webGLmmk: your doc is COOL. Why not integrating it in our documentation site? https://github.com/BabylonJS/Documentation

 

 

Will definitely do that. That WAS the plan, I've just been getting distracted. Going to add a bit more about getting CORS free images, with examples, then I'll submit it.

Link to comment
Share on other sites

Quote

Or did I missed something ?

Cris, my greenSphere/meshPlayer starts well above the floor (use control dragging to adjust camera to see things better).  A few 'z' keypresses, and my sphere has fallen halfway thru the floor.  It should ONLY fall until the bottom of the green sphere is against the floor.... because the green sphere is exactly the same size as meshPlayer.ellipsoid.

In other words, green sphere == meshPlayer.ellipsoid.  So... hmm.  If your project is working correctly, yep... I'm with @webGLmmk in saying "thats the best feeling."

But still, I wanted to do some learning, trying a "visual ellipsoid", and doing some more collision testing.  *shrug*  Goofin' around.  That's how I learn things.  :)  And yes, continuous collision is definitely not wanted, and I am glad that you discovered that.  @RaananW, @Deltakosh, and @Dad72 have all done advanced work with .moveWithCollisions, including discussing "rubbing on the ground/floor"... so there are many forum posts about .moveWithCollisions.

Don't quote me, buy I think I once looked at some code... that appeared to "back-out" a collision after it was detected.  In other words, I think I saw some code that tries to keep .moveWithCollisions from getting stuck in continuous intersect/collision.  But I'm not sure. 

I think I am using some bad numbers when I create the velocity variable, and that is making my green sphere and meshPlayer... drop into the floor.

I might play with it some more... after I grab a few more hours of sleep:)  It is a good playground/scene to do collision learning - with.  I hope you don't mind me/us extending your thread and doing some tests with your scene.  It is good fun!  Maybe I should try a "ramp" next?  Drive "over" certain sections of wall?  That would be a good torture-test for collision ellipsoids and fake gravity, huh?  :)  Perhaps we can clone/instance your current maze, and make a second and third floor... with along-the-side ramps connecting them?  Cooooool.  This COULD get demented. heh.

Someone else did something similar, once.  Not sure who, or what it's story is.  Good steal-able code, though.  :)  We once had a "maze contest" here on the BJS forum.  I think there were 9 entries, if I remember correctly.  *shrug*

Link to comment
Share on other sites

Wingnut, I'm very glad that you feel interested in my little game, and you can extending it by yourself. Thanks to your help, I can continually develop this maze game. Now I can move my spider robot with .moveWithCollision function successfully.

I will consider  add some ramp or step in my scene in the feature.

Thank you again for your  generous help!

@Wingnut

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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