Jump to content

Camera/Player collision with smaller object glitchy + First Person Shooter question [Some clarifying]


Recommended Posts

EDIT: My previous demo might not have been clear; you need to click the screen and lock the cursor, then you can look around. To make this more apparent, I've increased the size of the ground plane. https://playground.babylonjs.com/#E8MQGK#2

My player object is a FreeCamera with an ellipsoid value of new BABYLON.Vector3(1, 4, 1). The object in question is a cube Mesh created with MeshBuilder.Box with an initial size of (1, 1, 1). Now ideally when the player walks and hits it, the player moves up it like a ramp (and would not do so for taller objects), but I would be fine at the moment if he just stopped smoothly as if he had hit a wall for the moment. However, the current result is that he seems to momentarily move on top of it, then zip back out as if to fix the fact that it had gone inside the bounding box. This results in a "spazzing" back and forth when walking towards this shorter object. The spazzing gets lesser as the cube gets taller, and goes away entirely when the object is at the same height, but it is still a very glaring issue given my plan. What should I do?

On a side note, I followed an First Person Shooter tutorial (http://www.pixelcodr.com/tutos/shooter/shooter.html) to try and get myself started with what was supposed to be an example of good work, but the FreeCamera slows and eventually stops when pointing the view downwards. Can I get some tips on making a baseline FPS movement that works like your standard FPS would? Other examples I've found have this same issue.

Link to comment
Share on other sites


if you look at the Espilit demo on our homepage, you'll see that you can walk correctly everywhere and even walk up the stairs.

This is basically because the entire scene use a 1 unit = 1 meter approach plus a scene.gravity set to a (0, -9.81, 0)

Link to comment
Share on other sites

Ok gotcha :)

Well in our demo, there is only slope using planes and you can go over meshes (you can always try to increase the camera speed and reduce the gravity but it seems not what you want here)

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