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 Artoodiitoo · Feb 15, 2021 at 01:15 PM · collisionphysicsrigidbodypushing

Problems with pushing rigidbodies while standing on them

I have a player character, made with the rigidbody character controller, that can walk around and interact with things in my racing game.

You can get out and push the cars.

The problem is you can push the cars around while moving inside them too.

Is there any way around this? I´d like to keep the rigidbody character controller, since it allows many physical things and collisions alt text

inside.jpg (352.6 kB)
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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by AbandonedCrypt · Feb 15, 2021 at 01:33 PM

Ideally your car controller should be a different one than your player controller, so that you can either deactivate your player controller when driving a car, or make the car the player

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

Answer by MUG806 · Feb 15, 2021 at 01:47 PM

This really depends what you need the character to be able to do while in the vehicle. If you don't need them to move around inside the vehicle here are some things you can try:

  • Disabling or removing the rigidbody while the character is driving, then restoring it when they exit the vehicle

  • changing the collision layer of the player while driving to prevent collisions between the car and the player

  • create a joint between the character and the vehicle, this will lock them to the vehicle as well as disabling collisions between the character and the vehicle by default.

If you do need the character to be able to move around inside the vehicle things become much more complicated as the character will always be able to push the car if they are both rigidbodies. You can try increasing the mass of the car and decreasing the mass of the player, but how effective this is will depend on how you are moving the character.

tldr Realistically you either need to lock the character in place in the vehicle and remove the rigidbody while driving, or not use a rigidbody at all and move the character by other means.

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

Answer by Artoodiitoo · Feb 15, 2021 at 02:15 PM

Thanks, I use a joint to keep the player in place when sitting on the driver seat and driving, it´s not a problem there. But you can work on the car between races, and need to be able to walk around and inside it. Maybe I need to try a non-physical controller :(

Comment
Add comment · Show 3 · 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 MUG806 · Feb 15, 2021 at 02:18 PM 0
Share

You could try making the car kinematic while the player is working on it, so that it cant move. Or creating a joint between the car and the world.

avatar image Artoodiitoo MUG806 · Feb 15, 2021 at 02:55 PM 0
Share

Well I can´t really do that, since I need the car to be physical, like in a race after crashing and the car is on fire, and you need to get out of the car and behind the safety fence, but other cars in the race can still (accidentally) crash into your wreck.

I tried making the physic material of my player collider bit more slide-y, and disabling running while inside the car, that helps some but the bug still exists. It´s probably more a nuisance if you don´t have handbrake on than a cheat, so that might do for it :D

avatar image Artoodiitoo · Feb 15, 2021 at 10:19 PM 1
Share

I made a system that detects when player is inside vehicles, and changes the physics material for the player collider to zero friction, so I can use $$anonymous$$imal forces to move the character inside. Seems to work and has smaller effect on moving the car around when inside

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

252 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 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 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

Stop rigidbodies from bouncing 3 Answers

Tossing an object with the correct force at any distance from another so that it collides with the other 1 Answer

Is it necessary to attach a rigidbody/colliders to child objects? 1 Answer

Players can't move each other in multiplayer? 1 Answer

2.5D Platformer where character moves between points has issues where physics take player off of the line between points. 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