Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 JackReivaj · Mar 21, 2021 at 05:54 PM · velocitygravitymovefallingcant

Can't move when fall from high

Hi!! I'm doing a platform game, my first game and when I fall from very high with my player, he gets stuck on the ground and I can't move. Is there any solution to this? Has it happened to someone already? Notice that when in my player's rigidbody I put continuous in collision detection it doesn't stuck. But the problem is that I have to leave it in discrete. Because with continuous it doesn't let me kill enemies. I don't pass the script because I don't know which one i should pass and I have several, I have the script of the player, of the enemy, of player's feet which is for kill the enemy when I touch him with feets. If it is necessary to put some code I put it but maybe the same thing happened to someone. The provisory solution was this:

 public Rigidbody2D playerBody;
 public PlayerLogic Player;
 
 Update(){
 if (Input.GetKeyDown("l"))
         {
             Player.playerBody.transform.position = new Vector3(Player.playerBody.position.x + 1, Player.playerBody.position.y + 1, 100);
         }
 }

But of course that is not a real solution because it would be great to don't have to press a key to move if i get stuck.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by JackReivaj · Mar 21, 2021 at 07:59 PM

I thinks i solved with this code but i still testing.

 public Rigidbody2D bodyPlayer;
 public bool OnTheFloor = false;
     Update () {
     if (bodyPlayer.velocity.y <-50f)
             {
                 bodyPlayer.gravityScale = 1;
             if (OnTheFloor)
                 {
                     bodyPlayer.gravityScale = 5;
                 } else if ((bodyPlayer.velocity.y> 50f))
                 {
                     bodyPlayer.gravityScale = 1;
                     if (OnTheFloor)
                     {
                         bodyPlayer.gravityScale = 5;
                     }
                    
                 }
             }
     if (OnTheFloor)
             {
                 bodyPlayer.gravityScale = 5;
             }
     }        
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

119 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 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 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 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 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 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 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 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 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 avatar image avatar image

Related Questions

Move Agent with gravity, let him fall into a hole 1 Answer

Rigidbody y velocity is stuck on 0, gravity is not turned off. 2 Answers

Object won't fall when I apply horizontal velocity and is colliding with wall. 1 Answer

Falling through terrain with Grid Move Script 0 Answers

G Force Acceleration 0 Answers


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