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 RankoR · Nov 13, 2011 at 01:19 PM · rigidbodycollider

Collisions don't work properly

I have such scene:

alt text

I move platform with this code:

 float xMovement = xAxis * Time.deltaTime * 20;
 float yMovement = 0;
 float zMovement = yAxis * Time.deltaTime * 20;
 transform.Translate(xMovement, yMovement, zMovement);

When I move it not so fast, it works properly, but when it moves faster - the box falls through the walls and falls down. The properties of box and walls are these:

alt text

alt text

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

Answer by syclamoth · Nov 13, 2011 at 01:33 PM

Transform.Translate doesn't really care about collisions. If you are lucky, and the translation is small enough that it doesn't go all the way through your collider, the rigidbody will push the object back out in the next FixedUpdate, but otherwise collisions won't be detected at all.

You should be using

 rigidbody.MovePosition(transform.position + movement);

or, better still, use rigidbody.AddForce() to simulate actual physical movement. For platforms rigidbody.MovePosition should work- but make sure that you do it in the FixedUpdate step.

Comment
Add comment · Show 8 · 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 RankoR · Nov 13, 2011 at 02:33 PM 0
Share

$$anonymous$$ovePosition + FixedUpdate give no result.

avatar image syclamoth · Nov 13, 2011 at 02:37 PM 0
Share

Are we dealing with a very fast-moving platform here? Try setting the collision detection mode to 'Continuous Dynamic'- and the same with anything resting on it.

avatar image RankoR · Nov 13, 2011 at 02:47 PM 0
Share

Speed is about 10 coordinat units per second. Continuous Dynamic didn't help.

avatar image syclamoth · Nov 13, 2011 at 02:56 PM 0
Share

Well, looks like it's time to get into unusual physics engines. Do you speed up gradually, or does it immediately travel at that velocity?

In any case, you need to have some way of deter$$anonymous$$ing what rigidbodies are inside the box (probably through OnTriggerStay or something). You then have to manually either set the velocities of those rigidbodies, or make them transform children of the box.

avatar image RankoR · Nov 13, 2011 at 02:57 PM 0
Share

I found that it almost always falls through corners.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

My character falls over when colliding 1 Answer

Detecting a collider in 3D space. 1 Answer

Rigidbody cube randomly stops moving? 1 Answer

Player keeps falling halfway through terrain floor 3 Answers

Kinematic Rigidbody Collider not colliding with Static Trigger Collider 3 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