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 Stand Alone OS · Sep 04, 2014 at 04:08 AM · rigidbodybouncecollisions

Why Rigidbody Collisions Bounce?

Hello Everyone, I'm fairly new to unity so any help would be appreciated.

I currently have an 'NPC' with:

A Rigidbody (1 Mass, 0 Drag, 0 Angular Drag, Use Gravity, and all constraints but the Y Position) and A Box Collider

the npc is controlled with: this.transform.Translate(Vector3.forward * walkSpeed);

Once the player is in range of the npc he will chase after them, My problem is if I have multiple NPC's chasing me and they collide with one another they shoot(or bounce) into the sky? I can provide my code if you would like, However I believe it has to do with the rigidbody, If I set rigidbody.isKinematic = false; then they don't shoot into the sky. However then they don't detect collisions...

I've attempted to google around however most answers didn't really help. If anyone could point me in the right direction I would be grateful, Thanks again.

(I'm using javascript)

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by superluigi · Sep 04, 2014 at 04:20 AM

Just talking from experience, although I can be wrong, avoid using translate. Translate makes objects ignore collisions, at least it did every time I used it. For example if you have a floor and you make your character translate down he will go through the floor like it's not even there. Use addforce to push your rigidbody npc in a direction, or you can affect it's velocity directly. It is generally best to avoid messing with a rigidbody's velocity directly because you won't get accurate physics but for what you're trying to do it should be no problem.

These two xample are staight form the scripting reference. You should be able to understand the answer though. In case you're new to all this, addforce will push and the Rigidbody's velocity will climb depending on how much force you add while velocity immediately makes the rigidbody's velocity equal something. rigidbody.AddForce (0, 10, 0); rigidbody.velocity = Vector3(0,10,0);

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 Stand Alone OS · Sep 04, 2014 at 05:57 AM 0
Share

Thank you for your answer, I don't have the reputation to vote for your answer but I would. You wouldn't have a recommendation to handle the rotation of my NPC would you? Before I would transform.eulerAngles = Vector3(0, Random.Range(0, 360), 0); But as you can imagine this no longer works... Thanks again for your responds, Very helpful.

avatar image superluigi · Sep 04, 2014 at 06:05 PM 0
Share

I usually use transform.rotation = Quaternion.Euler(0, whatever you want here, 0);

avatar image
0

Answer by Redeemer86 · Sep 04, 2014 at 04:35 AM

Try setting tags for your enemies and attach scripts which ignore collisions on collision

 if(EnemyObject.tag == enemy)
 
 // Ignore Collision maybe using 

Ignore Collision

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Ball issue and question 0 Answers

Collisions when pushing object 1 Answer

RigidBody controller - Where to start? 0 Answers

Applying a force to multiple rigidbodies at once. 1 Answer

Stop my car from bouncing like a rubber band ball 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