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 Redmoth · Dec 20, 2013 at 08:45 PM · collisioncharactercharacter controllerweaponcombat

Charcontroller doesnt collide when not moving

Thanks everyone! So, here is the situation:

From testing multiple ways, i seem to have arrived to this conclusion:

Box, capsule, sphere etc collider: Does collide with any other object when not moving, However, When i make a script to get it moving as a character (translate, position = new position xyz) it always ends up pushing through other colliders and walls after a few seconds of making my character walk into them (we dont want our main character to just walk through chairs and walls do we?)

Character Controller: Only Collides when using the .move function, and NEVER goes through other colliders or walls, BUT, things will just go right through it when it is not under the move function in that frame.

So say i have 2 Character controller on my characters, and have one of them attack the other with a sword (the sword either has a box collider or a char controller) If the attacked character isnt moving, the sword just goes right through without triggering the collision.

How would I manage to get the sword to collide with the character controller when the character controller is NOT moving? Is there some hidden function i dont know about the character controller?

If impossible, what is the best way to get a sword to interact with a character wich either has a box collider or a character controller?

Thank you again to anyone who can help me!

Comment
Add comment · Show 5
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 Benproductions1 · Dec 21, 2013 at 09:15 AM 0
Share

How are you moving the sword? The sword will have to do the collision checking in this case, as it is the moving body.

avatar image Redmoth · Dec 21, 2013 at 09:47 PM 0
Share

The sword is moved by the animation of attack of the character. If the sword has either box or char controller, and the opponent has his char just staying idle, the sword goes through the opponent and does not trigger colision (either side) (opponent would have a char controller too in this situation)

avatar image Benproductions1 · Dec 21, 2013 at 11:36 PM 0
Share

As stated earlier, the box will have to be the object doing the collision checking. It therefore needs a rigidbody and your animation has to have "animate physics" enabled.

avatar image Redmoth · Dec 21, 2013 at 11:51 PM 0
Share

Thank you, i will look into that and set this question as answered!

avatar image Redmoth · Dec 21, 2013 at 11:55 PM 0
Share

See Benproductions1 Comments

1 Reply

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

Answer by Benproductions1 · Dec 22, 2013 at 12:05 AM

Hello,

In for optimisation purposes Unity only does one way collision checking. A non-moving rigidbody or character controller will not check for collision with bodes that move towards it. Instead that moving object will have to do the collision checking.

For a object that is being animated to do proper collision checking two things need to happen:

  1. Like with most other collision checking the object needs to have a rigidbody attached. Because it will be animated there is no need for it to do any physics by itself so having it be Kinematic is an added optimisation.

  2. For the animation to work properly in cooperation with collision detection the animator needs to emulate velocity from movement due to the animation. For this to happen you just need to enable the "animate Physics" option.

Now your collision detection should work on the sword.

Hope this helps,
Benproductions1

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 Redmoth · Dec 22, 2013 at 12:16 AM 0
Share

Thank you very much for all your help sir! $$anonymous$$UCH apreciated!

avatar image Benproductions1 · Dec 22, 2013 at 12:17 AM 0
Share

No problem, glad I could help

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

19 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

Related Questions

My Character Controller is falling through... everything... 4 Answers

My Character Controller Is Warping Randomly (/w video) 0 Answers

how to correctly check for a collision with a character controller 1 Answer

Terrain, Player falls through.... but only some parts. 0 Answers

Character Controller collision disabled after some time 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