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 Nanofus · Apr 12, 2012 at 03:16 PM · collisionrigidbodycolliderpush

How to prevent a rigidbody from pushing other rigidbodies?

I have a first-person controller that can carry rigidbodies in front of the camera. The rigidbody pushes other rigidbodies when hitting them. This allows the player to move very heavy rigidbodies too easily. How can I prevent this?

The rigidbody-carrying code I'm using can be found on the bottom of the first page of this topic, it's made by username85.

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
2

Answer by gregzo · Apr 12, 2012 at 03:16 PM

set your rigidbody's isKinematic property to true!

Comment
Add comment · Show 6 · 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 Nanofus · Apr 12, 2012 at 03:32 PM 0
Share

The carried rigidbody's? Doesn't seem to work. Here's my code: http://pastebin.com/pJCe7kRg

avatar image Kleptomaniac · Apr 12, 2012 at 03:50 PM 0
Share

I'm pretty sure you could set the rigidbody's mass to 0, or at least a very small number, and it shouldn't be able to push. Not sure though, haven't tested. Also, probably wouldn't be a very viable solution because it would affect physics calculations for your rigid, but it's worth a shot.

avatar image Nanofus · Apr 12, 2012 at 04:04 PM 0
Share

"rigidweight = rigidbody.mass; rigidbody.mass = 0.0000001;" when picking up the rigidbody and "rigidbody.mass = rigidweight;" when dropping it? Nope, it still pushes all other rigidbodies with the same force. The rigidbody that's being carried is moved around with "rigidbody.$$anonymous$$ovePosition(transform.position + transform.forward * holdDistance);", does this have something to do with the problem?

avatar image Owen-Reynolds · Apr 12, 2012 at 04:46 PM 0
Share

$$anonymous$$ovePosition tells it to go there, no maater what. To get a "physics-based" push effect, set velocity.

The problem is, characterControllers and physics-pushing don't mix (if your FP controller is charController based.) $$anonymous$$aybe look up hacks to make a CC push things (using OncharColliderHit) and adapt that to include the carried object.

avatar image Nanofus · Apr 12, 2012 at 05:18 PM 0
Share

The FP controller is a Character Controller, yes, and I've attached a script to it that enables it to push rigidbodies (I found it here: http://answers.unity3d.com/questions/17566/how-can-i-make-my-player-a-charactercontroller-pus.html). But what does this have to do with the collision of two rigidbodies? The character controller is not part of it. Thanks anyway.

(Btw, I tried setting the carried object's detectCollisions to false but it's a bit coarse solution. Also, when detectCollisions is set to true when the item is inside another object they both fly high in the air.)

Show more comments

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Making Colliders/Triggers or Rigidbodies move a Character Controller 5 Answers

How to make certain rigidbody2d's not able to push other rigidbody2d's? 2 Answers

Get angle from impact 2 Answers

Collisions between two rigidbody's and scripting collisions problem 2 Answers

Rigidbody stuck in colliders when moving and ricosheting. 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