• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by Cygon4 · Mar 20, 2013 at 11:37 AM · physicsrigidbodyjumpingwalls

Why is my Jump Height affected by Walls?

My game's main character is using a rigidbody:

  • The player's physics material has zero friction because otherwise, jumping and steering against a wall would make the player stick to the wall.

  • Jumping is done by applying a large impulse to the character via rigidbody.AddForce(..., ForceMode.Impulse).

Now when the player is very close to a wall (or steering into it), he can jump almost 50% higher:

Illustration of Jump Height Issue

Can someone explain this effect or offer a workaround?

jump-height-illustration.png (12.0 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Cygon4 · Mar 20, 2013 at 12:42 PM 0
Share

Additional observation: this happens even if I jump from some distance to the wall and touch the wall on the way up. It seems touching walls either reduces the effects of gravity or increases momentum.

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Cygon4 · Mar 20, 2013 at 12:53 PM

It took some searching, but I dug out another question here on UnityAnswers that provides a workaround:

Rigidbody Character Jumps Higher With At Least 2 Collisions

If I add a rigidbody to the wall (not just a collider) and enable its Is Kinematic property, the jump height next to that specific wall remains constant, avoiding the issue.

There is still a big WTF hovering over my head, but I remember having read somewhere in the Unity documentation that any object that interacts with physics should have a rigidbody, so I guess this is a "by design" issue.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Owen-Reynolds · Mar 20, 2013 at 02:10 PM 0
Share

Officially, "static colliders" (collider with no RB) are for things that will never move. $$anonymous$$inematic colliders are supposed to be for special cases.

Clearly, "bouncing off me" isn't a special case (it's the primary purpose,) so something odd is going on. You'd think ken-RB vs non would make ALL collisions a little different (Y isn't a special axis.) Hmm...

avatar image ypsilon · Apr 08, 2014 at 04:14 PM 0
Share

Thanks you for that man! Solved my issue straight away.

avatar image
0

Answer by Tanbar · Jan 18, 2019 at 04:25 PM

The Walls collider are tall thus when u jump(While hugging the wall) the Collider on the player still remains in contact thus Forces adds up making the jump more higher.

WORKAROUND

Simply make bool variable and make it true when in air and false on landing. and call the jump only when variable is false. ,Anyone facing this issue can just add bool variable which is true,when GameObject is in the air and false,when it lands.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Cygon4 · Jan 22, 2019 at 07:35 PM 0
Share

This is based on the assumption that my jump logic is faulty and lets the character jump when it is touching a wall.

That was not the case here. It was a physics issue. A composite RigidBody collider sliding on a static non-RigidBody collider caused the simulation to behave differently.

But maybe this answer helps others who have more down-to-earth (hehe, get it?) problems with their jump logic :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why does the player hover over the ground instead of touching it? Why doesn't it always jump when I press space? 2 Answers

How to make a ball able to go anywhere on my "field"?? 0 Answers

How do I make a bike? 1 Answer

Ball slows down too fast.. why? 1 Answer

Help with Water Buoyancy Physics (using a trigger) 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges