Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by TKEmil · Nov 14, 2012 at 08:59 PM · physicsbuggravitydouble

Double gravity when standing on two colliders, bug?

Hey,

We are developing a game as part of our semester project. In the game you play as a ball that has to reach the goal. The world itself is contructed from a lot of 1x1 cube prefabs.

The character has a jump ability (done by addforce in y-axis). Our problem is that when the character is in the middle of two adjacent cubes, it will only jump half as high.

Our preliminary guess was that the game somehow applied double gravity(one for each collider). We tested this by making two cubes in the exact same spot, and as assumed, the character jumped half of the intended height.

Just wondering if this is a known bug or if we are doing something wrong? There is a video showcasing our problem: http://www.youtube.com/watch?v=51G2ZozdFZ4

Regards

EDIT: We tried reducing the game to the very basic components and this is the ONLY script running:

 using UnityEngine;
 using System.Collections;
 
 public class VeryBasicMovement : MonoBehaviour {
     Vector3 brake;
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
     
     }
     
     void FixedUpdate () {
         if(Input.GetKey(KeyCode.LeftArrow)) {
             rigidbody.AddForce(new Vector3(-50, 0, 0));
         }
         
         if(Input.GetKey(KeyCode.RightArrow)) {
             rigidbody.AddForce(new Vector3(50, 0, 0));
         }
         
         if(Input.GetKey(KeyCode.UpArrow)) {
             rigidbody.AddForce(new Vector3(0, 0, 50));
         }
         
         if(Input.GetKey(KeyCode.DownArrow)) {
             rigidbody.AddForce(new Vector3(0, 0, -50));
         }
         
         if(Input.GetKeyDown(KeyCode.Space)) {
             rigidbody.AddForce(new Vector3(0, 400, 0));
         }
         
         ApplyBrakes();
     }
     
     void ApplyBrakes() {
         brake =  -1 * rigidbody.velocity * 400 * Time.deltaTime;
         rigidbody.AddForce(new Vector3(brake.x, 0, brake.z));
     }
 }
 

And it still has the same problem.

Comment
Add comment · Show 2
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 cassius · Nov 14, 2012 at 09:53 PM 0
Share

Is there a negative force in the y-axis added to the ball that is being called by the boxes themselves? Since you're using an AddForce to the ball's rigidbody to create the jump I'm not sure why gravity would act differently unless your boxes have colliders which contain a trigger to reduce the gravity or are applying a negative y-axis force.

avatar image TKEmil · Nov 15, 2012 at 11:56 AM 0
Share

No there is not. Just tried it with normal cubes. I guess that means that the problem scope is somewhat reduced to the character now.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sparkzbarca · Nov 15, 2012 at 06:42 AM

yea gravity doesnt work like that. :P Its really just a force applied constantly in the -vector3.up direction.

You could test this by seeing what the velocity is with gravity disabled.

there is a gravity checkmark in the rigidbody. If you turn it off and your velocity is still halved your code is being wonky not gravity. (i understand you'll keep going up but you should do so half as fast)

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

12 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

Related Questions

Applying Normal force from ground to player 1 Answer

Gravity on a rotating platform 1 Answer

how to make an object fall slowly ? 2 Answers

How can i rotate player when player jump ? 2 Answers

Roof of the builiding (physics) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges