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 /
  • Help Room /
avatar image
0
Question by boerue · Jun 12, 2017 at 11:34 PM · unity 5collisionrigidbodytransform.positionshake

Object shakes on collide!

 void FixedUpdate() {
         if (Input.GetKey(KeyCode.A))
             transform.position -= cameraTransform.right * (Time.deltaTime * speed);
 
         if (Input.GetKey(KeyCode.W))
             transform.position += cameraTransform.forward * (Time.deltaTime * speed);
 
         if (Input.GetKey(KeyCode.S))
             transform.position -= cameraTransform.forward * (Time.deltaTime * speed);
 
         if (Input.GetKey(KeyCode.D))
             transform.position += cameraTransform.right * (Time.deltaTime * speed);

Hello, this is my player movement code. Problem is whenever I collide with something (I am using box collider), my object (player) shakes and sometimes falls off (not through floor).

I searched for it and somebody had the exactly same problem. Answer said use FixedUpdate() and don't use transform.Translate... I wasn't doing any of that.

Sorry for my English if I did any mistakes, thanks for any answer.

Edit: I have a not permanent solution: In rigidbody increase the mass.

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

Answer by Davinder_Singh · Jun 13, 2017 at 06:47 AM

I only know the problem which is I think you are using rigidbody and collider both with your object which generally makes objects to shake when you are using code like:

transform.position -= cameraTransform.forward (Time.deltaTime speed);

Solution of your question is you need to change the way of moving your player(don't use transform.translate either). Because this way of moving forces the object to move from one place to another.

Please tell me when you get solution.

Sorry for improper answer.

Thanks in Advance

Comment
Add comment · Show 1 · 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 boerue · Jun 13, 2017 at 10:11 PM 0
Share

transform.Translate doesn't work with my line (or I didn't write it right). Is there another translate method? I don't have any solution yet but I am doing several tests.

  • set my players rigidbody mass to bigger than the cube (collide test). And the one with bigger mass doesn't fall. If you set the cube's mass to bigger than player's mass, then it falls.

  • wonder if there is a thing to do with box colliders size. You know, the bigger surface you have, stronger force you give to terrain. So you don't fall (in real life of course). I increased my X and Z sizes to bigger than Y. And did the first test: Nothing changed...

I hope you understand me so according to that two factors, maybe we can find a solution. Thanks for your advices btw.

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

204 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

Related Questions

Need a script to stick rigid body to any rigid body it comes into contact with. 1 Answer

How to make physics collisions act like in old games (NES, SNES especially) 1 Answer

Unity Ball moving inside the surface 0 Answers

how do i collide and kill the enemy while pressing space Unity 5 C# 2 Answers

Sphere with AddForce or Velocity not moving 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