Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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
1
Question by ShroomWasTaken · Aug 10, 2015 at 02:06 PM · collisionmoving

Collider not detecting collision with moving object

So, I have a moving object, and my player has a rigidbody.

The moving object (which has a box collider on it) just goes straight trough the player. It doesn't detect the player and the player doesn't detect the box, UNTIL i move the player. Then it detects the box and does what it should. But i need the box to detect the player even if the player isn't moving. How would i do that? Current Code :

     void OnCollisionEnter(Collision coll)
     {

         Debug.Log("Collided with : " + coll.gameObject.name + " It has the tag : " + coll.gameObject.tag);

         if (coll.gameObject.tag == "Car")
         {
             Kill();
         }
     }
Comment
Add comment · Show 2
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 NeverHopeless · Aug 10, 2015 at 03:18 PM 0
Share

Did you tried to implement the inverse case by attaching this behaviour on moving object ? and also, try making Collision Detection = Continuous ins$$anonymous$$d of Discrete.

avatar image ShroomWasTaken · Aug 10, 2015 at 03:49 PM 0
Share

Collision detection to continous didn't work, and i don't know what the other thing is :/

1 Reply

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

Answer by Major0 · Aug 10, 2015 at 03:26 PM

Here's a checklist:

  • Both the Player and the Car have Rigidbody component on them.

  • Make sure IsKinematic in Rigidbody component is set to false on both the Player and the Car.

  • You're using the physics engine (e.g. AddForce) to move the objects, but not modifying their Transform (e.g. Translate).

Comment
Add comment · Show 2 · 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 ShroomWasTaken · Aug 10, 2015 at 04:25 PM 2
Share

I had no idea the car needed a rigidbody too, Ï thought he just needed a box collider? o.O Anyways, thanks so much! First thing worked!

avatar image OmerPasa3328 · May 09, 2021 at 10:19 PM 0
Share

My problem is player and car(or whatever) have rigidbody and not checked iskinematic but I use just this to move:

 void Start()
     {
       transform.position = new Vector3(0.15f,3.2f,2.05f);   // just for initial placement
       GetComponent<Rigidbody>().velocity = new Vector3(-5,0,0);
     }

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

27 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

Related Questions

Collision of a moving object with a standard 3rd person controller 1 Answer

UNET Players are movable on collision 2 Answers

Object move without an input 1 Answer

Moving Platform Collisions with Custom Movement Script 0 Answers

Making the object collide while moving in the forward dir. (Vector3.forward) 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