• 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 RGI · Mar 17, 2013 at 04:49 PM · javascriptcollisionphysicsrigidbodycollision detection

How do I "remove/disable" collision?

Hi, I have an object moving using rigidbody and addforce. And Iam spawning some other objects that are in the way of the first object. When they collide, there is a script for the collision detection which works fine. Problem is, when they collide, the main object slows/stops and starts spinning and in the end it flies away. I need the collision to happend but I cant have any of these results. The script removes the 2nd object on collision but it still moves the first object. I've tried fixing the rigid body of the first object but then I cant move it with addforce.. what do I do?

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

3 Replies

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

Answer by fafase · Mar 17, 2013 at 05:19 PM

You would have to set the "On the way" object to isTrigger but you would still have to modify your scripts.

All OnCollisionEnter(Collision col) becomes OnTriggerEnter(Collider col) and you need to set all colliders to isTrigger.

As a result you get the collision but when the first object hits them, you get your collision but no resolution meaning it just get through it.

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 Khada · Mar 17, 2013 at 05:22 PM 0
Share

It would be easier to write movement code for the main object than collision response code for the others, or am I missing something / not getting your point?

avatar image fafase · Mar 17, 2013 at 05:46 PM 0
Share

You may be right. It depends what the OP is doing with the object on the way, do they disappear, do they get pushed away while the main continues? If first, I am right :), If second, you are right :(

avatar image RGI · Mar 17, 2013 at 07:47 PM 0
Share

Thanks to both of you. I think fafases solution is better, I will try it out tomorrow, maybe on tuesday. The object indeed disapears after the collision. I dont think Iam capable of writing my own movement script and I already wrote the game for the default unity force system and it took some time to balance it out.

avatar image Khada · Mar 18, 2013 at 03:23 AM 0
Share

Ah, then go with fafase's answer.

avatar image RGI · Mar 19, 2013 at 02:39 PM 0
Share

Works like a charm, Thank you.

avatar image
0

Answer by infinitypbr · Mar 17, 2013 at 05:54 PM

I think there's a checkbox in the collider or rigidbody area on the object that forces it to not rotate. Click those and it won't move on the axis you choose. There's 6 checkboxes, 3 for rotation and 3 for movement. I'm not sure how to make it not slow down though.

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 Loius · Mar 17, 2013 at 05:57 PM

You'd have to set the velocity of the object directly, after the collision. You can also disable rotation easily in the rigidbody inspector.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

13 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

Related Questions

Avoid Player bouncing when colliding with objects 3D 1 Answer

Always Get Same Physics Collision Rebound Force 1 Answer

Broadphase CD in Unity - pile of rigid bodies unsolved 0 Answers

OnCollisionEnter isnt called when player lands on object 1 Answer

how to make an Explosive rigidbody trigger by another collision box 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges