Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 tulloch100 · Nov 03, 2017 at 01:43 AM · physics3dcar

Car collision impact with object

I'm making a racing game and I have objects that I have to avoid but if they hit my car I want the car to stop or be pushed back a little. My problem that i'm having is that when my car does get hit its pretty much gets flipped over ever time.

This is what it looks like https://streamable.com/hfjkk

These are my car settings alt text

These are my boulder (object) settings alt text

what settings would u suggest that I tweak so that the car is strong than the boulder?

Comment
Add comment · Show 9
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 unit_nick · Nov 03, 2017 at 07:17 PM 1
Share

It's not about it being stronger, it's about the return of force. There is no reason for the car to go backwards unless something pushes it backwards. Since there are no objects moving in that direction there is nothing to push it in that direction. Therefor the only way to get that force is to have some small amount of elasticity in your model. It must compress then slightly decompress after it has halted. That is where you get the bounce back from.

avatar image MaxGuernseyIII unit_nick · Nov 03, 2017 at 07:31 PM 0
Share

@unit_nick, is this not an answer?

Also, it seems like the OP doesn't want the car to fly upward, would elasticity solve that problem? It seems like you'd have to neutralize or dampen z-forces imparted by those objects in some way. $$anonymous$$aybe change the shape of the colliders?

avatar image unit_nick MaxGuernseyIII · Nov 03, 2017 at 07:35 PM 0
Share

I don't bother much with answers atm. If they like the comment and it works they can convert to an answer. I'm thinking if you don't want the object to go up then you need to have the center of gravity below the impact point of the model.

Show more comments
avatar image pako · Nov 03, 2017 at 08:57 PM 1
Share

I doubt that this can be easily solved with the Physics Engine, as is. The size of the boulders, combined with the size of the car, result in the car flipping over, and that's quite realistic.

Also, the boulders have infinite mass (no rigidbody), so even if the mass of the car increased, I don't think it would make much difference, as far as colliding with the boulders is concerned.

$$anonymous$$aybe if the boulders were much higher... but that would be changing the design.

So, I think that the easiest way to produce the desired effect, which would be something unrealistic as far as physics is concerned, would be to script what happens when the car collides with the boulder, i.e. something of the type: OnCollisionEnter => "bounce back", where "bounce back" could be an animation.

avatar image MacDx pako · Nov 03, 2017 at 11:33 PM 0
Share

Agreed. $$anonymous$$aybe something like setting velocity towards the normal of the hit point, making the car "bounce back".

avatar image tulloch100 MacDx · Nov 03, 2017 at 11:57 PM 1
Share

I'm all for changing the shape and size of the boulders

So could making it much smaller maybe fix the problem or would be better to put a OnCollisionEnter => "bounce back", script on?

Another thing would changing the physics material on the boulder or car do any difference

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by unit_nick · Nov 04, 2017 at 03:25 AM

How about something like.... (pseudo code)

 // save collision mass as min of rb mass and obstacle mass
 
 // on collide set rb constraints to lock object to transform forward
 
 // on rb forward <= 0 add force = % of collision mass * either backwards or reflected 

Comment
Add comment · Show 4 · 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 tulloch100 · Nov 04, 2017 at 06:16 AM 0
Share

What would this look like in c#

avatar image unit_nick tulloch100 · Nov 04, 2017 at 06:21 AM 0
Share

oh, ok. I hadn't actually watched the video, I see your objects are moving. I will add some code when I get a bit more time.

avatar image tulloch100 unit_nick · Nov 04, 2017 at 06:32 AM 0
Share

Thanks for that much appreciated

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

133 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

Related Questions

Wheels Are Too Much Inward 0 Answers

3D Hook With Swing Physics 0 Answers

Setting Wheelcollider BrakeTorque to 0 does not release brake 0 Answers

Performance Physics.Checkbox/CheckSphere vs Collider/Trigger 1 Answer

My simple car leans INTO the turn, and leans over on two wheels. 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