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 Codelyy · Dec 10, 2015 at 08:22 PM · c#rotationcollision3dcollision detection

Collision problem

I'm trying to make a remake of a game on the ps2 in unity using C# and one of the objects within the game acts very strangely to me at least but I don't know how to recreate it in unity.

Lets say there is 3 of these objects, 2 at the bottom and one on top of the two. The objects will always look at the player when they come close but when they rotate, they never collide with each other so my guess is they are set to not collide with the same object but collide with the player. Though that doesn't make sense as the object balancing on top of the other two is perfectly fine, so there must be collision or else that top object would just fall through the other two below it.

My guess at first is that the objects had no gravity but that must also be wrong since if you destroy the two blocks under the top block then the top block will fall down.

Does anyone have any idea how i can do this in unity?

Comment
Add comment · Show 7
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 LazyElephant · Dec 10, 2015 at 09:02 PM 0
Share

What exactly do you mean when you say they don't collide with eachother?

avatar image Codelyy LazyElephant · Dec 10, 2015 at 09:29 PM 0
Share

I mean they don't interact with each other, so they go right through each other when rotating ins$$anonymous$$d of hitting each other. But the top object ins$$anonymous$$d sits perfectly on top of the bottom two objects and doesn't go right through them.

avatar image LazyElephant Codelyy · Dec 10, 2015 at 09:37 PM 1
Share

Is it possible for one of these things to move completely through another in the horizontal direction? It sounds like the collider is just smaller than the model, so the geometry outside of the collider won't halt the rotation.

Show more comments
avatar image rfuhrer · Dec 12, 2015 at 06:44 PM 0
Share

Hi try to explain a bit better what is going on, what you want to achive. A screenshot would help as well. Sounds like a problem that should be solvable if I know what the actuall problem is.

avatar image dhore rfuhrer · Dec 13, 2015 at 12:35 AM 1
Share

I believe the issue was resolved already as a Best Answer was already selected by the OP. Also, if you expand the replies to the comment above you'll see that there are screenshots and more info too.

3 Replies

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

Answer by LazyElephant · Dec 11, 2015 at 05:11 AM

You could make this happen using multiple colliders. Add an Empty game object as a child of the object and add a box collider to it. Shrink the collider on the object and the empty game object and move them so they look like in the picture. alt text

The next step is to create 2 new layers, one for the empty and one for your game object. Go to Edit->Project Settings->Tags and Layers and add two new layers.

Assign one layer to each of the objects, then go to Edit->Project Settings->Physics and change the collision matrix so the layers collide with each other, but not with themselves.
alt text That will allow them to rotate without colliding with each other, while still being able to stack.


screenshot-2015-12-10-233133.png (67.3 kB)
screenshot-2015-12-10-234844.png (24.5 kB)
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 Rad-Coders · Dec 10, 2015 at 10:36 PM

You shouldn't change the transform of the object. Rather use the physics engine, so use add torque or use a motor.

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 dhore · Dec 11, 2015 at 01:53 PM

I'd say you just want the bottom two that are next to each other to not collide (so that they can turn "through" each other) but still have the top one collide with both of the bottom ones. This is really easy, just tell the physics engine to ignore collisions between the 2 bottom objects using Physics.IgnoreCollision

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

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

46 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

Related Questions

Finding number of bowling pins knocked over 1 Answer

Flip over an object (smooth transition) 3 Answers

Resize Array Based on Value 2 Answers

Check for collision while animating 0 Answers

if statement not working when detecting collision between two prefabs 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