Hot answers tagged

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 ...
DMGregory's user avatar
  • 130k
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 ...
Bálint's user avatar
  • 14.8k
3 votes
Accepted

My character just floats up into the sky

Try ...
Hamza Hasan's user avatar
  • 3,367
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 ...
Yosh Synergi's user avatar
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 ...
Christopher H.'s user avatar
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: ...
jgallant's user avatar
  • 8,354
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 "...
Dibz's user avatar
  • 158
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: ...
Stephane Hockenhull's user avatar
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 ...
House's user avatar
  • 73.1k
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 ...
GorkTi200's user avatar
  • 116
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 ...
AturSams's user avatar
  • 10.5k
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 ...
Rakesh's user avatar
  • 539
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 ...
Ariss's user avatar
  • 31
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 ...
Unreal_Me's user avatar
  • 355
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, ...
Bram's user avatar
  • 3,709
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 ...
basklein's user avatar
  • 426
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. ...
yees_7's user avatar
  • 21
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 ...
House's user avatar
  • 73.1k
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 ...
Martin's user avatar
  • 203
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. ...
avereux's user avatar
  • 121
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: ...
Bob_Gneu's user avatar
  • 222
1 vote
Accepted

How to jump in Box2D with LibGDX

you can do like this: In your hud class ...
Leonardo Lima's user avatar
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 ...
Justin Markwell's user avatar
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 ...
DH.'s user avatar
  • 551
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
Adolf's user avatar
  • 111
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 ...
Neal Davis's user avatar
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 ...
Bill Rock's user avatar
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'...
DMGregory's user avatar
  • 130k
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 ...
SaviorXTanren's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible