I made a script that accounts for character momentum. Have fun jumping on moving objects.
This is pretty cool.
One general note - pics or gifs or a video clip showing what exactly you have are always greatly appreciated. As devs, we all tend to be too lazy to click a link if we don’t know what exactly we’re getting into.
Help us be couch potatoes. Show us whatcha got
Here’s some more video of what this does
Compare that to
REALISTIC MOMENTUM!!!
I tried to help Sim find out how to account for going in diagonal directions and applying the correct amount of body velocity (because that’s how this works)
But was unable to get a correct solution. I think he’s going to make a new thread asking for help (this is a public source script so it will benefit all of Roblox, so if anyone knows the problem that would be awesome if it could be solved).
Basically the problem is due to the camera coordinates, when the character is looking diagonally (with respect to the x or z axis), the force applied to the body velocity will sum greater than the walkspeed of the player. Making the character travel faster if they jump diagonally while also looking diagonally.
Seems interesting. Not sure how I can take advantage of it right now.
@Amazeman I think we had a thread somewhere that discussed that very issue
Yeah it was GuestCapone Documentation - Roblox Creator Hub That thread inspired me to make this.
Awesome work! Was disappointed to see the lack of rotation support, but I added it myself. Here’s my mod of it if you wanted to see.
mp4 video: http://i.gyazo.com/314b17b46c085b7f30006c738932b696.mp4
Can’t wait to find something to use it for, haha.
EDIT: Math was wrong before. Now it’s fixed. Thanks to OP for pointing that out.
Since the old version kept you stuck to the platform by calculating where it’s rotating to I think it has its uses for platforming and stuff. I uploaded that version here if anyone still wants it.
mp4 of the sticky version: http://i.gyazo.com/51e59e1f95b11f98d9663d1de7466ef2.mp4
Pretty neat, but I found a few problems with it pretty quickly:
[ul]
[li]Not sure if it’s just me or what but jumping diagonally (jump while holding A/D + W/S) feels more sluggish than typical diagonal jumps.[/li]
[li]Jumping while walking straight causes the walking animation to loop if you take your hands off the controls before landing.[/li]
[li]The script immediately tries to grab the character before it exists, so this happens online and requires you to respawn before taking effect.[/li]
[/ul]
EDIT: Looking at the console also made me realize the script is called “Momemtum”
EDIT 2: More detailed repro for the animation bug: Hold W, jump, let go of W before you hit the ground and you’ll walk in place. A S or D in place of W lead to the same bug.
The Diagonal keys (A/W, W/D, S/D, S/A) still need a better way of figuring out what velocity to use, right now it’s just doing the EX: The sum of W and D divided by 2.
The jumping animation will be further investigated.
I made the wait longer at the beginning of the local script should fix the last issue.
Also the spelling error was fixed.
I fixed diagonal jumping and implemented the proper wait-for-character solution.
Can’t reproduce the jumping animation though.
Am I hijacking this project? Haha, I hope not.
…that works I suppose. Though you could bulletproof it (in case something odd happens and it takes more than a second for the character to be created) by doing something like this.
Thanks for that :D. It’s too bad I’m only in Algebra 2 xD I wish I understood the deep math stuff, then again I’m only 16 so lots of time to learn things.
Could you create a test place with the train? I don’t think I’ll ever use it but I’d still like to play around with it to see how smooth it is on the rig that you have set up with the train.