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 Sueko · Sep 13, 2012 at 06:31 AM · rigidbodycharacter controllercollideiskinematic

Ethereal Character Controller

Hi!

I have several AI driven characters that when moving keeps colliding with each other. How can I do to avoid this?

I am trying to acces the Rigidbody in the Character Controller component in order to set the IsKinematic property to true, but is not working. Is this the way to go? Is there a better solution? Why do I receive null when calling:

GetComponent().attachedRigidbody;

Thank you!

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 AlucardJay · Sep 13, 2012 at 08:10 AM 0
Share

try gameObject.GetComponent(Rigidbody);

or gameObject.GetComponent("Rigidbody");

avatar image Sueko · Sep 13, 2012 at 08:51 AM 0
Share

Thanks, I tried it but it is still nto working. I get NullReferenceException. I am using C#, so I tried this without success:

gameObject.GetComponent().is$$anonymous$$inematic = true;

There is no Rigidbody on the GameObject. The Rigidbody is provided by the Character Controller, which inherits form Collider. Will really setting the GameObject to is$$anonymous$$inematic solve do what I want?

2 Replies

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

Answer by asafsitner · Sep 13, 2012 at 06:48 AM

You can access the rigidbody component directly via `transform.rigidbody`

I presume you're using Unity free, because if you're using pro you would probably do better using the built-in `NavMesh` and `NavMeshAgent`.

Another possible approach to your problem that will solve collision between AI agents but still allow them to collide with the environment is to set them on a physics layer of their own and then set the collision matrix so that this layer won't collide with itself.

Comment
Add comment · Show 3 · 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 Sueko · Sep 13, 2012 at 09:32 AM 0
Share

Thanks, I tried accesing transform.rigidbody directly: doesn't work. There is no Rigidbody on the GameObject. The Rigidbody is provided by the Character Controller, which inherits form Collider.

You are right, I am using Unity Free. How does the Nav$$anonymous$$esh works? What are they useful for?

But....YES! The layer trick solved it!!! Had no idea about this feature, I am learning. Awesome! Solution was only uncheking a checkbox...After 3-4 hours messing around!

Thank you asafsitner!

avatar image asafsitner · Sep 13, 2012 at 11:13 AM 0
Share

Always happy to help ^^

You can accept the answer so it won't appear on the question queue by clicking the tick on the left, below the vote options.

Nav$$anonymous$$esh is a solution for path-finding, built into Unity pro.

avatar image Sueko · Sep 13, 2012 at 11:21 AM 0
Share

Sure, I tried to do it, but I messed up. I wrote my answer as a new answer and sent it without noticing. A message came up saying that ad$$anonymous$$istrators where going to review the answer. I guess I will be able to do it when reviewed. Right know it says:

We're sorry, but this question already has an accepted answer. Please remove the accepted status from the other answer first.

avatar image
0

Answer by Sueko · Sep 13, 2012 at 11:46 AM

Thanks, I tried accesing transform.rigidbody directly: doesn't work. There is no Rigidbody on the GameObject. The Rigidbody is provided by the Character Controller, which inherits form Collider.

You are right, I am using Unity Free. How does the NavMesh works? What are they useful for?

But....YES! The layer trick solved it!!! Had no idea about this feature, I am learning. Awesome! Solution was only uncheking a checkbox...After 3-4 hours messing around!

Thank you asafsitner!

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

11 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

Related Questions

Activate physics when animation ends 0 Answers

Ragdoll driven game 1 Answer

Cannot register Collision from behind. 0 Answers

How to setup character Collisions? 2 Answers

Fps Ladder script... 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