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 MyNick · Jul 08, 2014 at 09:02 AM · collisionrigidbody

Problem with pushing an object

Hey guys, I try to make a first person game where you can go and move objects. When you press the left mouse button i save the object that in front of me (in a range) into a variable. Now when i move i push the this object, moving the mouse up and down will make this object go up and down. The object will have no gravity at this time and fly in the air. If the first distance that the object was from the player is X then as long the mouse button is pressed the distance will try to be X as well in front of the player. This box (the one that i grab) has a rigid body. To move this box to the position I want, in front of the player I use rigidbody.MovePosition, this function supposed to move the object without collide it with others in the way. The problem is where there a wall. I can push this box in the air. How can i make sure that when i move a rigid body it doesn't pass through other objects? I understood that this function supposed to do that. In addition, I tried to change the velocity of this box and not the position. I can still push the box through walls. This time, before it pass the wall there is a lot of tiny jumps, A LOT. This is very ugly too. If i hold the box close enough then it won't pass through the walls but when I come close enough to the wall it will move like crazy. I don't know how to describe it but I think every unity user know that. It happen because my wall, player and the box are almost at the same place, they collide.

So my 2 questions are:

How can i make sure that when i move a rigid body it doesn't pass through other objects?

How can i disable that if the player hold the box close enough and go into a wall it move like crazy?

Thank you guys for your time :)

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 Raynoko · Jul 08, 2014 at 11:02 AM 0
Share

i had same problem, but i used simply any collider, i mean box sphere or any collider. and then problem solved

avatar image robertbu · Jul 08, 2014 at 03:36 PM 0
Share

I find solving these problems is not a one-size-fits-all solution. I have to play with the situation until I have something that works the way I want. Three things to explore:

  • Take a look at the standard DragRigidbody.js script (Assets > Import Packages > Scripts). They use a spring joint at the point of dragging.

  • See if reducing the fixedTimestep improves the situation. as a start, go to Edit > Project Settings > Time and reduce the fixedTimestep from the default of 0.02 to 0.01. This will result in more frequent physics calculations.

  • Go to Edit > Project Settings > Physics and set the '$$anonymous$$in Penetration For Penalty' to 0.0.

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Animator overriding collisions? 0 Answers

Why does my player fly through my barrier? 2 Answers

Colliding fast moving object with a slow moving object 1 Answer

Any way to ignore collision between rigidbodies and colliders/character controllers? 1 Answer

Fixed Joint - Collision Problem 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