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 Sajjoo · Apr 26, 2011 at 09:10 AM · collisionobject

Fast moving object passing through other objects.

Hello guys, I am pretty new to unity3d and making a small example. actually i have a cube which moves with my arrow keys. now i have walls on the road i want my object to hit the wall but it pass through the wall.

i also have used this code but no result.

http://www.unifycommunity.com/wiki/index.php?title=DontGoThroughThings

any help will be appreciative. thanks

Comment
Add comment · Show 6
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 Cyb3rManiak · Apr 26, 2011 at 09:46 AM 0
Share

Do you have colliders on your "walls"? What kind? Box? $$anonymous$$esh? Do you have a collider on your floor/road? Or does your cube float in space and is moved by your scripts alone? Do you have a collider on your cube?

avatar image Sajjoo · Apr 26, 2011 at 09:50 AM 0
Share

i just have box collider on my floor and wall and also $$anonymous$$esh renderer is attached to them.

avatar image Sajjoo · Apr 26, 2011 at 09:51 AM 0
Share

i can move my cube from arrow keys with transform.translate.

avatar image Kacer · Apr 26, 2011 at 10:03 AM 0
Share

maybe its because your box is moving too fast/is too small to be detected by the colliders?

avatar image Sajjoo · Apr 26, 2011 at 10:09 AM 0
Share

rigidbody.AddForce(tranform.right * speed) is not working. my object aint moving with force.

Show more comments

6 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by superpig · Apr 26, 2011 at 09:20 AM

Your cube needs to have a non-kinematic rigidbody attached to it, and you have to move it by applying forces, rather than by setting transform.position.

If you've got the rigidbody, make sure that 'Collision Detection' is set to 'Continuous.'

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 Sajjoo · Apr 26, 2011 at 09:22 AM 0
Share

right but if i uncheck the kinematic box in rigidbody my cube hides / blew away in space.

avatar image Sajjoo · Apr 26, 2011 at 09:26 AM 0
Share

and yep i am using transform.translate not transform.position.

avatar image superpig ♦♦ · Apr 26, 2011 at 11:08 AM 0
Share

transform.translate isn't applying forces, it's just setting the transform. You need to use Rigidbody.AddForce() and similar.

avatar image Rinaxln · Mar 12, 2016 at 11:56 PM 0
Share

thanks god!!!!!! set 'Collision Detection' to 'Continuous.' ~~~~~problem perfectly solved (>3<)

avatar image
1

Answer by Cyb3rManiak · Apr 26, 2011 at 01:03 PM

First - unless you have a particular reason to script this whole thing from scratch the way you did - I would advice you to attempt using the CharacterController.

About your situation - if you DON'T have a collider on your moving box - that's your problem. A collision between two objects must involve at least two colliders (one on each object), and a rigidbody on at least one of the objects. You have colliders on your walls - so all you need is a collider on your box.

BTW - Double check that the box even collides with the floor. If the rigidbody you have is kinematic - it means it isn't effected by gravity. Do you simulate it? Do you have some line in your script that attempts to move the cube down each frame? I would first check to see if it collides with the floor.

About the rigidbody and forces discussion... To make things clear - if your rigidbody IS kinematic - the physics engine doesn't effect it. You use straight-forward scripting to move your cube (Transform.Translate, Transform.position etc.). If your rigidbody IS NOT kinematic, it means it can move from forces from the physics engine, and then you should use AddForce/Torque etc to move it. Which way you go is entirely your choice.

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 AngryOldMan · Apr 26, 2011 at 11:39 AM

Have you tried increasing your skin width? how big (scale wise) is your cube? how big is your level, what speed is the rigidbody moving at?

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 brentrkendall · Feb 26, 2017 at 01:27 AM

I had objects passing through other objects even after considering all the usual culprits: rigidbody, colliders, isKinematic, continuous collision detection, etc. In my case, I eventually discovered the cause of the problems was the MATERIAL on the object getting passed-through. It had a material with a partial transparency (alpha value), and at those certain transparent spots (which weren't visible to the naked eye), my projectile would pass through. An easy way to tell if your problem is related to the MATERIAL on an object is to set the material of the pass-through object to just a based default plain material, and see if the pass-through no longer occurs. If so, then you'll need to modify the transparency/alpha values on the problem material before reapplying it.

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 ccjbn · Apr 12, 2019 at 03:12 PM

I had to set my object to Continuous Dynamic, because my object still passed through. Of course you can also limit the speed of your object. It seems to happen at higher speeds. I can only assume that that is because the object position is skipping chunks of screen to appear like it is faster and it skips over the area where the collision is detected.

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
  • 1
  • 2
  • ›

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

Lag when hitting an object 1 Answer

Making a rigidbody cube snap 90 deg at a time 1 Answer

Can an object to transfer to another as it increases your speed? 1 Answer

How can I do a collision check with a specific Object? 3 Answers

Remove objects if 3 or more of them are colliding 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