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 JustJunuh · Jul 03, 2015 at 10:22 PM · collisionmovementrigidbodytransform.translatejitter

How to get transform.Translate to work with rigidbodies

Ok so I am moving the player via transform.Translate for a third person platformer. And I have a rigidbody attached to the player only for the collisions, and add force.

When I use transform.Translate, the wall collisions are jittery. Which makes sense since transform.Translate doesn't respect the rigidbody physics.

So I tried to switch my movement to AddRelativeForce() but I was running into speed cap issues and most importantly, lots of sliding (which again, makes complete sense). And for a third person platformer slipperiness doesn't work well (unless you were on ice I guess).

I really like using transform.Translate for the precision, is there any way I could continue using it while keeping rigidbody physics intact? So far, I'm not seeing any other way to do it within the rigidbody physics :/

Thanks in advance! Actual code is appreciated!

Also here is the translate code:

 //adjust is a value that moves the player over slants and slopes
 //accel goes up to 20f
 //horizontal is the joystick input
 
 transform.Translate (new Vector3(0f,adjust,1f) * accel * horizontal * Time.deltaTime);

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 meat5000 · Jul 03, 2015 at 10:22 PM

You cant use Translate when moving a rigidbody for collisions. It teleports.

If you dont want to manipulate force or velocity try MovePosition

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 JustJunuh · Jul 04, 2015 at 06:43 AM 0
Share

Alright so I'm trying $$anonymous$$ovePosition and its working fairly well. I'm still getting the jittery wall collision wall though. Is there some sort of raycast or capsulecast that I could do to fix the jitter? I switched all my loops to FixedUpdate() ins$$anonymous$$d of Update() and that seems to help. $$anonymous$$y camera now works a little better than it did before all this so thats a plus. Thanks for your help so far!

avatar image
0

Answer by Cherno · Jul 03, 2015 at 11:05 PM

I never had a problem with moving rigidbodies via Translate. I largely followed this tutorial:

https://www.packtpub.com/books/content/unity-3x-scripting-character-controller-versus-rigidbody

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

Box collider (with Rigidbody attached) gets stuck into another Box Collider 0 Answers

Player getting stuck in ground (3D) player has Rigidbody, and Box Collider, world is Mesh Colliders 0 Answers

Keep Horizontal Momentum after Jump 2 Answers

Rigidbody slows down before touching its target 1 Answer

isKinematic object doesnt collide with wall 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