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 CG-DJ · Sep 05, 2013 at 02:40 AM · physicsrigidbodyenemypushignore

Player Pushes Enemies. (That's bad) -Still Unanswered-

So, I have some rigidbody enemies. They use a rigidbody.MovePosition to move.

The problem is this, when the character runs into the players, the velocity from the character is transferred to the enemy (think newton's cradle). I don't want this. Is there a way to ignore physics from the player? I don't want to be able to walk through the enemies. I want them to solid when I hit them, and stand their ground.

Does that make sense?

EDIT:

So the problem has changed a little bit after a lot of digging! It has something to do with my scripts (links found in comments). I use a Move function to move the enemy, and I put a velocityX variable into the move to move my enemy. When I set velocityX to 0 and the enemy is still, then the enemy doesn't get pushed around, but when the enemy is moving, the enemy gets pushed around. I need ideas!

EDIT 2:

I changed to a AddForce function, but it still hasn't helped! I made a video of the problem to try and better explain it: Link to Video!

EDIT 3:

I'm back again... I totally rewrote the script. I took everything to the dry erase board and wrote it all out before I typed it up. The pushing problem still persists though. I can't figure out what's going wrong!!! Any ideas? (If you want, my skype is cg.artist4jc. If you contact request me, please put "Unity" in the contact request message.)

|-------------- LINK TO SCRIPT --------------|

Comment
Add comment · Show 10
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 CG-DJ · Sep 06, 2013 at 06:52 PM 0
Share

Anyone there???

avatar image CG-DJ · Sep 07, 2013 at 05:30 PM 0
Share

Here is a video of my problem!

avatar image meat5000 ♦ · Sep 07, 2013 at 06:15 PM 0
Share

Can you not simply un-check the 'Animate Physics' Box?

avatar image CG-DJ · Sep 07, 2013 at 06:29 PM 0
Share

I tried checking Animate Physics on my Character's animation component. Didn't help. But thanks for the suggestion!

Any other ideas?

avatar image meat5000 ♦ · Sep 07, 2013 at 08:07 PM 0
Share

It's supposed to be un-checked... but I guess it was to begin with :/

That's the box that tells Unity to push objects around with animated limbs etc. Are you trying to use Character controller on enemy too?

Only other suggestions are,

Increase enemy mass

OR

Remove Player/Enemy correlation from Collision $$anonymous$$atrix; Project Settings -> Physics

EDIT: Damn just noticed your 'I dont want them to walk through' comment :P

Which $$anonymous$$ove function do you use?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by aldonaletto · Sep 05, 2013 at 02:57 AM

If you set the player mass to a value much smaller than the enemies, they will barely move when hit by the player. Another possible solution would be to freeze position and rotation in all axes in the Constraints field of the enemies: this would eliminate physics reactions to collisions, but you still would be able to directly move the rigidbodies. Finally: use a CharacterController instead of a rigidbody in the player - a CharacterController is constrained by any collider, but won't push rigidbodies.

Comment
Add comment · Show 19 · 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 CG-DJ · Sep 05, 2013 at 03:46 AM 0
Share

Ok, thanks!

I'll try it tomorrow and get back to you!

avatar image aldonaletto · Sep 05, 2013 at 12:24 PM 0
Share

HINT: You may let Freeze Position Y unchecked in order to preserve gravity effects. This usually works fine when the enemies have box colliders, but may make them jump if their colliders are spheres or capsules: when hit at a point below the "equatorial line", the resulting impact has +Y components that may push the rigidbody up.

avatar image CG-DJ · Sep 06, 2013 at 06:22 PM 0
Share

Ok, the mass thing didn't work at all. And if I freeze all the axises (axi?) then the player can just walk through the rigidbody. It will detect collision, but not stop. And my player does have a Character Controller, but the enemies have rigidbody controllers.

Any other ideas? I just want the enemies to ignore any physics from the character. So any inertia or conservation of energy is ignored.

avatar image gardian06 · Sep 06, 2013 at 07:39 PM 0
Share

when you changed the mass of either the difference needs to be a factor of about 100x to stop the interaction in the direction of the bigger thing.

avatar image aldonaletto · Sep 06, 2013 at 09:39 PM 0
Share

The player already is a CharacterController? It should be stopped by any collider, if moved with $$anonymous$$ove or Simple$$anonymous$$ove - don't use Translate or modify its position directly!

Show more comments

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

21 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

Related Questions

Rigidbody Ignore another Rigidbody? 5 Answers

Is it possible to get the physics engine to ignore calculating a rigidbody? 1 Answer

Push object away from another object 1 Answer

Amnesia like objects, in unity. 2 Answers

Cube collision problems when held 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