• Content count

  • Joined

  • Last visited

  1. aponty

    Collision with walls using Cannon

    I'm sure there's something you could do based on the collision event with the ceiling, but that sounds like a nuisance. I feel like there should be a more straightforward solution to what I presume is a pretty common issue (perhaps building default camera settings into Cannon, so you don't have to use multiple physics engines?), but hey- for a first project I'm just going to avoid using ceilings at the moment
  2. aponty

    Collision with walls using Cannon

    Hey! Success! Took a bit of combining ideas, but I have something that looks right, and doesn't hang at the top of jumps! Thanks a ton for that hidden property advice, I haven't seen anything about that anywhere else. Just in case anyone else is struggling with this, here's a playground (with some extra baggage, I trimmed most things out for clarity but not everything) http://www.babylonjs-playground.com/#NMPK63 Basically I'm using iiceman's example from here- (thread) http://www.html5gamedevs.com/topic/12198-camera-jump/ (playground) http://www.babylonjs-playground.com/#XN87O and also Wingnut's suggestion of changing camera._needMoveForGravity = true successfully keeps the camera from 'hanging' at the top of jumps. It sounds like it would do the opposite, right? But whatever. It's not perfectly smooth- but it it's good enough for moving forward at least Thanks again Wingnut! Very helpful and much appreciated
  3. aponty

    Collision with walls using Cannon

    Hey ya'll, thanks for the insights! So, there's a lot here. First off, do I NEED a physics engine? Not necessarily, I suppose. I don't really NEED a game, either But, all the attempts at making a camera "jump" using the Babylon collision detection look...well, kinda bad. No offense Gryff, and thanks again for the example, but that jump doesn't really have the feel I'm looking for; something a bit more fluid and natural. I pulled off a similar one without using a physics engine...and it just feels weird. You move linearly up, and then stop, and then either hang out there until you hit an arrow key or crash back to the ground. I think results might be a bit computer-variable with that, but I don't have a good way to test that theory unfortunately. A furthermore, I'd like to have physics interactions between other meshes in the game, so I'm going to be using one for something. In the spirit of parsimony, I figured why use two things to do the same thing? Oh, and while the camera isn't a mesh, I have set an ellipsoid around it. That's a mesh, correct? I tried using different shapes, using the normal mesh constructor methods, and had variable results. But they all had trade-offs. Using a square resulted in better collisions, but the camera 'bounced' when you turned it, for example. I'll give that _needMoveForGravity method a shot, and I guess I'll abandon my lovely cannon.js-powered jump for the sake of sane camera collisions. I just figured there was a simple way to do it by setting the bounces for the camera to 0 or changing the camera ellipsoid mass to something really high, but it's not really looking like it.
  4. Hello all, I've been working through a project (using a lot of advice I've found from lurking here) and I've run into an issue. My goals are pretty modest; I'm trying to 1) have a natural jumping mechanism, and 2) have collision detection between the camera, ground, walls, etc. At first I did this just using Babylon's .checkCollisions, which works very well for camera vs object and camera vs wall collisions. However, I couldn't get this to work properly for jumping. Even following other's tutorials, (http://www.html5gamedevs.com/topic/12198-camera-jump/) I wasn't getting the results I wanted; on my computer, at least, all of those playground sketches still "hang" at the top of the jump until other arrows are pressed. So, I switched gears and tried using Oimo and Cannon. I still can't get Oimo to work, for some reason ( "this.world.worldscale is not a function" ring a bell for anyone? I can't find anything on that) but I've had decent results with Cannon. In short, I have the jump working, but now the collisions vs the walls are all...funky. Check out the playground sketch here- if you hit the wall, everything spins like mad. https://www.babylonjs-playground.com/#GYZQLK#3 I'm pretty stuck. I don't see how this collision detection is any different than between the ground and the camera, but something is obviously off. I've tried vs other horizontal objects (boxes, spheres) and had the best results setting the camera's physics imposter to a box (which makes turning all jittery). Any suggestions or ideas? Thanks all!