Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 MRswifting · Feb 21, 2018 at 07:49 PM · rotationphysicsrigidbodycollidersfixedupdate

Player Is able to rotate through walls.

So, My player Is set up so he kinda "bows" when he looks down, While "bowing" really fast and moving forward against a wall my player is able to glitch through the said wall, I am using "transform.eulerAngles" on the body (In fixedUpdate), I believe rotating the body through a rigidbody would work better but It seems having a rigidbody in any form as a child of another rigidbody (, The player GameObject) seems to just make It spazz out.


Things I have tried:

  • Making every collider convex.

  • Adding a sphere collider to the head.

  • Slowing movement and rotation (/ "bowing") speed based on distance to wall.

  • Clamping the maximum speed of rotation/"bow".


All of these seem to work pretty well together, But my player still spazzes out a lot so what I'm asking Is If there Is any "proper"/simpler way to achieve my goal?


alt text


Thank you for taking the time to read this :)

Comment
Add comment · Show 4
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 TreyH · Feb 21, 2018 at 09:17 PM 0
Share

For a crude workaround, you could try adding a thicker collider to walls (it looks a little thin from your screenshot). Is there any other motion happening outside of FixedUpdate for this object?

avatar image MRswifting TreyH · Feb 21, 2018 at 11:03 PM 0
Share

Tried a thicker wall, Would need to be way way too thick to work sadly, All motion (movement/rotation) has been done In fixedUpdate.

avatar image seandolan · Feb 21, 2018 at 11:23 PM 1
Share

Do you want the player pushed away from the wall when it bows or do you want the bow animation to stop when it's head hits the wall?

avatar image RobAnthem · Feb 21, 2018 at 11:48 PM 0
Share

Does the player have a rigidbody? Because that would prevent the collider from existing in the same space as another collider.

2 Replies

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

Answer by MRswifting · Feb 21, 2018 at 11:32 PM

(Thank you @seandolan, Don't know how I missed it), So I managed to get It working amazingly with by using "OnCollisionStay" and "OnCollisionExit" to toggle a bool to disable then enable downwards camera (/ body) movement.

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 seandolan · Feb 21, 2018 at 11:56 PM 0
Share

I think you meant to thank @RobAnthem ins$$anonymous$$d :)

avatar image MRswifting seandolan · Feb 22, 2018 at 12:43 AM 0
Share

No, I do mean you, "do you want the bow animation to stop when it's head hits the wall?" made me think of that solution.

avatar image seandolan MRswifting · Feb 22, 2018 at 12:48 AM 1
Share

Oh excellent then :) I love when sometimes on this Answer site, the result is that you get inspired to look at things a little different - which solves the problem. Glad this is not a "headache" for you anymore.

avatar image
0

Answer by JonPQ · Feb 22, 2018 at 01:49 AM

aha! this is an age old physics problem. Easy solution.... not perfect. simplest one is to use one big bounding box/capsule/sphere that surrounds the player even when at maximum bow.

Lots of FPS shooters , have this problem also. (weapon passes through wall when character rotates) Their solution is to collide the body/capsule... and collide the gun separately and move the gun backwards along a vector along its length until not colliding any longer with the wall.

you could do this by having secondary collision during lateUpdate. after collision has finished. (detach collider and rigidbody from your character head) The 2 points come from a single node in character head, the 2 points are before and after character move, animation and collision. Then you do a SphereCast, from old to new position. (just like a raycast, but use a sphere of radius of the head) This will tell you if the head collided with anything as result of move. and will also tell you how far head moved before reaching collision.... and/or how far you'd have to move it back to get it back out of collision... At this point you have a couple of options... move the whole object back along the before->after vector... by the distance required to move the sphere out of the collision. just rotate or move the head back... or stop just any further bending forward (might be tricky) (or move it back to last valid bend angle) good luck take 2 world points

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

169 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 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 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 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 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 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 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 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 avatar image

Related Questions

Is it okay to use ForceMode.VelocityChange in Update()? 1 Answer

Active rigidbodies and number of Contacts 1 Answer

When and when not to use kinematic rigidbody? 2 Answers

Player with RB + capsule collider can easily penetrate ALL kinds of primitive colliders. What do I do to fix this? 2 Answers

Returning a rigidbody back to its original x and z rotations through physics forces. 2 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