Stop Sliding down Slopes (SSS)

Hey, that’s pretty good. I’ll use booleans to trigger the movement within the registerbeforerender function. There is a reason for that. It’s like this: every computer has different settings for repeat delay and speed. If they were different then the game would play differently on a different machine. With booleans, set true on keydown and false on keyup, the RBR function has the if-else question pertaining to the booleans, allowing for the movement to feel the same on different computers. I hope that was clear enough.:wink:

I’m still learning, and hopefully I can get this implemented and uploaded to the site.

I’ve been thinking about starting a weekly blog about the game, and maybe make a youtube series. Ya never know.:blush:

Thanks for all of this help, Wingnut. I’ll add you in the credits.:wink:

1 Like

Yeah, that’s cool.

Umm… I would use two functions… one for rotate(eitherDirection, power)… and one for translate(direction, power). Inside those functions… put the setLinearVelocity and setAngularVelocity crap that I added.

Make a universal turner and a universal mover. :slight_smile: Then call them after checking which flags. Nice and clean… two powerful easily-reusable functions.

1 Like

Thanks for all of the help! I should have the update done by the weekend!:blush:

1 Like

My pleasure.

https://www.babylonjs-playground.com/#IFN77Q#14

There’s a version with the two “universal funcs” installed (lines 105-119). Look how clean the onKeyDown handler is. Yum!

Good luck!

Leave me something to do!

Yeah, it’s SO CLEAN!:hugs::hugs::hugs:

1 Like

haha. Those functions are actually the update to my flying thing… so I’m a little excited.

First time I have ever “exported” transformForce() to any other project… was scared that i would break it, but no. Lots of good stuff happening for me, here. AND, I think we have some lurkers who are probably CATAPULTING up the physics learning curve… because of our conversations and tests.

We’re hot right now, G! :slight_smile:

I tried deleting anything that I didn’t need from those 1600 lines of code, and ended up breaking it. a lot. I’m glad you could though!

It used to be WAY worse. I allowed the flyer to be flown with control/shifted arrow keys, control/shifted WASD, control/shifted numpad keys, and control/shifted keys-that-encircle-the-colon-key. Essentially fly with left hand, right hand, or numpad. Then I added the BJS GUI and removed all that keypress checking.

It’s difficult to believe, but I once coded even worse than I do now. :slight_smile:

You’ve done some games in other environments, haven’t you? Do tell, when you have time.

I’ve tried in several other environments. Most of the time they end up as dead projects because I move on to something else. I’ve stuck with BABYLON.js for a while now because of the progress that I’ve made and the wonderful community. That was the one thing most others didn’t have. I’ll send a lengthy message of all of the one’s I’ve tried.

1 Like

Ok, just one more…

https://www.babylonjs-playground.com/#IFN77Q#16

Turned-ON jump. (spacebar).

Ummm… our high linearDamping… REALLY made the player fall slowly… sort of FLOAT back to the ground. So, I needed some changes.

Line 55… -80 newtons of -Y gravity. Phew. Earth default is something like 9.8. heh.

In line 125, I needed to POWER-UP, baby… cuz the sphere has a mass of TONS when gravity is this high. :slight_smile: Playing with sphereImpostor mass setting surely will have some affect, too. Fun!

Look at the vector3 in line 155. See the .1 amount of z-value. Yep, our boy jumps forward just a bit. Aim him at the camera and start whackin’ the spacebar… this frog will hop right up to you. :slight_smile:

Hey looks good. I guess my sphere on the bottom and on collide event would help prevent the jump-flying.

By jump-flying… do you mean folks hitting WASD keys while airborne? I don’t think this currently does that… but I’m not sure why/why-not.

not really, I mean pressing space at timed intervals in the air. (like an infinite double-jump)

1 Like

Ahhh, yeah, that it DOES allow. :slight_smile:
https://www.babylonjs-playground.com/#IFN77Q#17
Line 155 is a quick-fix.
:slight_smile:

I have my own solution. have a boolean called “canjump” set to true. when you jump, it sets it to false. on space keyup, it turns true again. works like a charm

1 Like