Jump to content

Having some issues with collisions for a hard stop


agmcleod
 Share

Recommended Posts

Hello, me again.

 

Working on a top down game: http://projects.agmprojects.com/topdown/

 

After clicking Tap to Start, you should be able to click in a space, and the little cube in the center will follow. It's moving fine, but doesn't collide into other cubes or the walls on the edge. I have the collisionsEnabled on the scene, checkCollisions on each mesh, and added ellipsoid to the player & other cubes to be safe. Any ideas what I am missing?

 

Here's the source if it's easier: https://github.com/agmcleod/wrathofthecube

Link to comment
Share on other sites

I feel that the player cube does not come into collision with other cubes as they are on top of the player.

 

It is quite difficult to verify your scene with a lot of code to analyze.
 
Trying to do a scene with the bare minimum by removing everything that is not necessary to analyze your code more easily.
this.mesh.position.y = 2.5; // try higher values ​​here

 

Link to comment
Share on other sites

Can add a #debug to the URL in the scene & refresh. Disables movement controls and initializes with the freecam instead. Can move around and see they all have an equal bottom.

 

Yes, but it does not withdraw the amount of code you have written. but this can help

Link to comment
Share on other sites

locally i tried having the player constantly moveWithCollisions 0.2x 0.2z, and yeah it hit a box, and shifted not 100% under, but maybe had 1/4 of the box still sticking up after. So the collision is definitely happening, just not the response I'm looking for.

 

Adding checkCollisions = true to the ground plane (realized that's not in the CreateGround code of the engine), it works much better. Getting some really weird slow velocities though when approaching boxes, like it's lagging. But then when i move around some more, it moves smoothly, and goes right up to the edge of the box.

Link to comment
Share on other sites

Works a little better. I have it moving towards a corner when debug mode is on. Oddly though it moves up its Y coordinate once getting close to the corner. No meshes aside from the ground underneath the cube. I can force correct the y coordinate (as it should always be 0.5), but not sure if that's really ideal.

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