• 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 hillsy7 · Nov 16, 2017 at 07:57 PM · rigidbodycollider

Colliders sometimes not working and unwanted force

Hi Guys,

OK I'm sure I'm doing something wrong here but sometimes I can move clean through colliders. Especially when they are perpendicular to my angle of movement. This sometimes even works on the terrain if I hit it at the wrong angle. I've recorded the effect here and shown what settings I've got on.

https://youtu.be/dWc0YbfymRw

Secondary to that the collisions give the model unwanted force (I'm using translate to move the player)......I'm guessing that's best addressed in script?

Sorry I'm quite new to Unity so I'm not sure what I should be addressing using the physics engine and what should be dealt with in script.

Any help you can give will be massively appreciated.

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
Best Answer

Answer by MarshallN · Nov 16, 2017 at 08:39 PM

First, always use force to move objects if you want the physics system to know about it. Definitely use force to control the player ship, using Translate can cause it to (you guessed it) translate right through a wall, because Transform.Translate is just straight-up teleportation.

The other issue is that the collider on your ship has Discrete collision detection. Change it to Continuous Dynamic (because it's always moving and you don't want it to go through things) and you'll have better results.

That unwanted force you're seeing on a collision is from the collider partially clipping into another one and the physics engine causing it to be spit back out. Using force to control the ship should stop that, and making a Physics Material and assigning it to objects will let you control collision effects as you like (so you could have a trampoline object that bounces the ship and have everything else have a coefficient of restitution of 0).

Comment
Add comment · Show 5 · 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 hillsy7 · Nov 16, 2017 at 11:03 PM 0
Share

Ah right. That makes sense! I'll readjust the control script and see what happens

Cheers dude.

avatar image MarshallN hillsy7 · Nov 20, 2017 at 07:10 PM 0
Share

If this worked for you, $$anonymous$$d marking it as the correct answer? If not, lemme know what's up and I'll see what I can do.

avatar image hillsy7 MarshallN · Nov 20, 2017 at 10:00 PM 0
Share

Hey dude - actually got to work on this finally on the train today....not sure what was going on, but the collider was being moved by the ship on contact and being pushed into the terrain though none of the other elements were being moved......

....I've sort of fixed it by freezing the collider on the tank.....the Continuous dynamic though does seem to have fixed the terrain collision - haven't managed to drive through it yet.

I've also switched to using moveTowards rather than translate, which might've helped as well. At the moment I'm still testing the colliders as I've got the ship moving how I want it to and don't want to have to switch to using addForce just yet if I can help it, and I'm using the Update function to detect and nullify any unwanted force after a small time.

But yeah - got me looking at the right things....cheers mate.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

107 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

Related Questions

Avoid one gameObject skin in another gameObject 2 Answers

how to Apply Gravity at Run time ..????????? 2 Answers

OnCollisionEnter not triggering when two rigidbody collide via Instantiate 1 Answer

How do I disable all rigidbodies and colliders in a scene in unity? 2 Answers

Parent-child rigidbody issues with collider 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