48
votes
Accepted
How to differentiate landing on top of an object from falling down the side?
There are three common ways games sort this out:
Minimum Separation Vector
Upon a collision, compute the shortest movement that pushes the bodies apart into a non-intersecting position.
If I've ...
6
votes
Accepted
How to control jump strength by how long the player presses the jump button?
You have essentially 2 options. You can either apply a constantly decreasing force to the character while the player is pressing the space button and stop immediately when they release it or apply a ...
3
votes
Accepted
3
votes
How does server correct late input
For this to be handled correctly you need to design your network protocol to do something called "continuous transitions". Client send's all time packages to the server with a order. This way the ...
3
votes
Accepted
How to make an object jump an equal height whenever it hits the ground?
Are you getting different results per jump on the same item, or are you trying to replicate the same height on different objects?
ForceMode.Impulse is dependent on the mass of the object you're using ...
2
votes
How to check if grounded with rigidbody
Here is a simplified example of how you could implement a check to see if your gameObject is grounded or not. It is not perfect, but should probably work for your situation:
...
2
votes
dynamic body jumping out of water object
I've never tried to get this to work myself, but it seems like you would just need to increase the upward force applied to the jet ski's body as a function of the depth of the jet ski below the "...
2
votes
Accepted
Dynamic force behind logical jumping on 3 axis'
So first, in the formula:
velocity.x = x - ( x + ( 10 * math.cos ( ( rz + 90 ) * math.pi / 180 ) ) );
The two 'x's cancel out each other:
...
2
votes
Accepted
Logical math behind jumping in a 3D world
It's the same as you'd do it for 2D, just with an extra axis. Use the same exact equations you do for a 2D game, something similar to the equations of motion or the kinematics equations.
For each ...
2
votes
Accepted
Prevent player from jumping on a mesh
You could modify the existing collider on the mesh so that it is less "realistic" (aka less form-fitting) but better blocks the area in question.
You could also just remove the collider altogether ...
2
votes
Accepted
Creating proper jump mechanics in LibGDX with Box2D?
SMB "weakens" gravity to extend jump height when these three conditions are met:
You are still moving upwards.
You didn't release the jump button since you left the ground.
You didn't collect a power ...
2
votes
Accepted
Play animation of the jump properly in Unity2D
Jump Animation in 2D Games
There are three main state in any Jump state which can be understood with
the help of this image
.
so for smooth jump animation-
First thing we need to set the ...
2
votes
Play animation of the jump properly in Unity2D
It would be smarter to create a separate animation for the landing frame, and make sure your current animation is set to not loop when you click on it in the inspector. Use an animation controller to ...
2
votes
Jump-through & drop-down platform
I'm pretty sure you can deal with this by ignoring the collision if the y-component of the velocity is positive (the player is moving upward).
Alternately you might be able to use the collision ...
2
votes
Keep platformer jump height consistent with different frame rates
You need to decouple the render frequency from the simulation frequency: You measure the delayed time, do an appropriate amount of simulation steps, then render the frame.
The easiest way to do this, ...
2
votes
Height in 2D game
So, the way jumping works in Zelda is kind of unintuitive at first, but if you think about it, it makes a lot of sense.
In modern games, sprites and models ARE the game objects, so we've become used ...
2
votes
Player double jumps immediately with a single press when using new Input System
If control.StartRun == false and control.CanDoubleJump == true you are double-jumping right after jumping.
...
1
vote
Accepted
Why does my Character Jump only Half as High?
F=MA. Or, Force = Mass * Acceleration.
It appears you're dividing out the mass from your queued forces and impulses to deal with just acceleration, but you're not putting the mass back in when you ...
1
vote
Accepted
Inconsistent jump height
The most commonly used method in commercial engines is the semi-implicit Euler method that I'm already using as you can see in my pseudo-code (https://gafferongames.com/post/integration_basics/). But ...
1
vote
Accepted
Jump Script Component For Character Controller
Couldn't find a solution that works like AddForce, but I solved this using a verticalVelocity variable that gets passed into a Vector3 jumpVector variable which calls Move on the characterController.
...
1
vote
Why does the player jump every time it touches the ground in my JavaScript game?
Update - Nov 28, 2016
One solution to your issue is to switch to mousedown and mouseup with the following event handler, as shared before:
...
1
vote
Accepted
1
vote
Unity, how to detect landing after jump?
You can use a layer Mask and check against it.
[SerializeField]
private LayerMask groundLayer;
bool onground = false;
Set the ground you use to a ground layer ...
1
vote
How do I make my character jump on a platform?
The function you are calling (jump) is only being defined AFTER the method that is handling the input, so it happens the error "jump is not a function".
Just move ...
1
vote
Creating proper jump mechanics in LibGDX with Box2D?
iforce2d to the rescue. if you can do some vector math nothing is impossible.
https://www.iforce2d.net/b2dtut/jumping
1
vote
Ball jumping algorithm
I have a suggestion.
Design short segments of block configurations (maybe a sequence of 4 to 10 blocks). Make several configurations (maybe 30) and play with them in game until you are clear on ...
1
vote
Accepted
how to make my character jump
You need to implement Kinematics -
Movement Obliquely in his game. Of course, if you want to simulate our world. Remind your world your rules. Or if you prefer to use a ready-made physical engine like ...
1
vote
Accepted
How do I convert gravity from pixels per frame² into Unity's Rigidbody2D gravity scale parameter?
There's going to be some variation in how you approach this, depending on whether you're going for "pixel-perfect retro re-creation" or "playable prototype to learn about making platformers." You don'...
1
vote
Accepted
Jump-through & drop-down platform
I was actually able to accomplish this by doing the following (there might be a better way than this, but it worked). This answer below is a bit specific to Box2D, as this was the original question's ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
jumping × 114unity × 49
c# × 30
physics × 29
2d × 17
platformer × 17
java × 12
movement × 10
collision-detection × 9
libgdx × 9
animation × 8
javascript × 5
box2d × 5
input × 5
c++ × 4
godot × 4
rigidbody × 4
control × 4
android × 3
mathematics × 3
game-maker × 3
raycasting × 3
touch × 3
xna × 2
algorithm × 2