Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 londonbridge411 · Mar 04, 2021 at 06:50 PM · collisioncollidercontrollerglitchwall

Quickly spinning player glitches through walls

Video of glitch

Hello! I am seeming to have this problem and I honestly don't what's causing it. It doesn't do it when I walk normally into it. I've tried putting the rotation in FixedUpdate() and nothing changes. I've also tried setting all of the colliders to continuous dynamically.

Thanks!

EDIT: It has something to do with my weapons. When I disable them and I have no weapons, I can't spin through.

Comment
Add comment · Show 3
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 UnityM0nk3y · Mar 04, 2021 at 07:25 PM 0
Share

What method of "Moving" do you use? If you use Rigidbody.velocity/Rigidbody.addForce - then make sure that the movement happens in "FixedUpdate". Also, does the weapons have colliders on them?

avatar image londonbridge411 UnityM0nk3y · Mar 04, 2021 at 07:45 PM 0
Share

Movement: transform.position += new Vector3(Input.GetAxis("Horizontal") Time.deltaTime moveSpeed, 0, Input.GetAxis("Vertical") Time.deltaTime moveSpeed);

The weapons do have colliders on them.

EDIT: Thanks! Taking the colliders off fixed it, but now things look weird because the gun clips through enemies.

avatar image UnityM0nk3y londonbridge411 · Mar 05, 2021 at 08:23 AM 0
Share

@londonbridge411 Cool! I will post you an answer soon! :)

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by UnityM0nk3y · Mar 05, 2021 at 09:07 AM

I would suggest you use "Physics Movement", rather than "Moving" the game object directly!! (Keep your weapon collisions on, when trying this, it should still work).

I only used Unity 2D so far, but this is relative in 3D too!

Here is how to set it up correctly, so that your "collisions" works.

  1. Make sure your "Player" has a Rigidbody and a Collider.

  2. Set up your Rigidbody, like mine in the image. Rigidbody NOTE: Ensure that "Interpolate" is on.

Next, use this code to move your playerObject:

     public float movementSpeed;
     private Rigidbody rb;
 
     void Start()
     {
         rb = gameObject.GetComponent<Rigidbody>();
     }
 
     private void FixedUpdate()
     {
         rb.velocity = new Vector3(Input.GetAxis("Horizontal")*movementSpeed ,0, Input.GetAxis("Vertical")*movementSpeed);
     }

  1. Also, if you find that you get "stuck on walls", add a "Physics Material" with no "friction" to your "Box Collider" to do so:.

  2. Right click on the "Assets" folder in the inspector.

  3. Choose: Create -> Physics Material.

  4. Name it "noFriction". Then at the top right, make all the values "0", and "minimum".

  5. At your "Box Collider", drag the new material into the "Material" section.

  6. You should have no more "friction on walls".


Hope this helps!!


help01.png (16.1 kB)
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
avatar image
0

Answer by b4guw1x · Mar 05, 2021 at 10:49 AM

Like UnityM0nk3y said, change collision detection to continuous should fix the error

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

209 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 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

how to stop colliders in a collision while using kinematic ways instead of physical ways? 2 Answers

Detecting collisions with raycast or not? 1 Answer

isTouching() with multiple colliders 0 Answers

Stop Dashing through walls 1 Answer

Make Character Controller a Box? 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