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 Gillissie · Oct 09, 2011 at 07:35 AM · collisionrigidbodycolliderplayer

simple collision not working

I feel stupid to have to ask for help on this.

I have a player object with a capsule collider (I don't want to use the character controller because I don't want gravity). I also added a RigidBody component and marked it as Kinematic and turned off gravity.

I have other static objects in my scene with primitive colliders but no rigidbody.

When I move my player I want it to collide with the static objects and NOT PASS THROUGH. I'd like it to slide around the colliders it runs into, like you would expect a player to do when colliding with something at an angle.

I don't really care about the collision events at this time, I only want to prevent the player from walking through stuff. What am I missing?

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

1 Reply

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

Answer by syclamoth · Oct 09, 2011 at 08:32 AM

You need to have a non-kinematic rigidbody to enable physics of any kind! A kinematic rigidbody will not bounce off of other objects, because it is assumed that it is not being moved in any physical way. If you are moving your object just using transform.Translate or related methods, it will never interact with other colliders unless there is also a non-kinematic rigidbody on the same object (in which case you shouldn't be using transform.Translate anyway). If you don't want gravity, you can just turn off 'useGravity' on your rigidbody, or in a more general way, you can set 'Gravity' to (0, 0, 0) in the physics settings to create a zero-gravity environment.

Also- in what way do Character Controllers have gravity? You have to manually code that in! (It's part of what annoys me about them...)

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 Gillissie · Oct 10, 2011 at 02:53 AM 0
Share

I realized that there are a couple of problems.

1) I have to use rigidbody.$$anonymous$$ovePosition() and .$$anonymous$$oveRotation() to manually move my rigidbody, ins$$anonymous$$d of the normal transform.position, etc.

2) Apparently I don't understand the full meaning of "kinematic" because I understood it to mean that the rigidbody would be manually controlled ins$$anonymous$$d of controlled by physics. This would be my character - manually controlled. When I have kinematic enabled, my character won't move at all using the rigidbody.$$anonymous$$ovePosition() method. I have to disabled it when moving him, then re-enable it when he stops, otherwise he'll float off into space after bouncing off obstacles. This seems odd to me.

To answer your question about Character Controllers and gravity, I was looking at the docs for "Simple$$anonymous$$ove", which says "Gravity is automatically applied." I see now that it doesn't apply to plain 'ol "$$anonymous$$ove". $$anonymous$$aybe the CharacterController will work for me after all, but I don't see a method for setting the rotation.

avatar image syclamoth · Oct 10, 2011 at 02:55 AM 0
Share

You just use Transform.rotation to rotate CharacterControllers.

avatar image themusicdork · Nov 10, 2011 at 04:30 AM 0
Share

you can use freeze location under the rigidbody settings to have it still be kinematic & only controlled through code

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Parent Object 0 Answers

Advice for Intersecting Colliders 0 Answers

My character falls over when colliding 1 Answer

Problem with collision - Collision.other.gameObject is obsolete 1 Answer

Maintain velocity after impact with kinematic rigidbody 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