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 ryf9059 · Aug 31, 2013 at 02:40 AM · movementsmoothtranslate

A bit shaky when translating

I noticed a problem in Unity with translate. When use getAxis for translation. It moves smoothly but the object was a bit shaky while moving. My code is very simple

 void Update () {
     float hori = Input.GetAxis("Horizontal");
     float ver = Input.GetAxis("Vertical");
     Vector2 transVector = new Vector2(hori, ver);
     transform.Translate(transVector * 5 * Time.deltaTime);
 }


Here is an example of my problem:

https://docs.google.com/file/d/0B7nGTxuhFgJQZlZ3WHprRWFmc1k/edit?usp=sharing

There is a cube and an animated skeleton. The effect might not be obvious with cube but is very obvious with the skeleton. Even it moves at smooth rate but it's shaky and is unbearable.

I have tried this on several computers and they all have the same problem. I've never been able to get a completely smooth without shaking movement in unity. Can someone help? Thanks

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 DESTRUKTORR · Aug 31, 2013 at 03:04 AM 0
Share

Are you certain it's the transform and not your mouse? Have you tried using a different source of input perhaps, or a better mouse pad/better mouse? I really don't see any reason why this would be happening, given what you've used, here, aside from that or the distinct possibility that you might have too much other stuff going on that's bogging down the system, and the shaking may be caused by a slight lag?

Normally, I'd say you should be using FixedUpdate for a transform alteration, but given that you're using an input for it, you want it called each frame, so that's not really an option :P

avatar image getyour411 · Aug 31, 2013 at 03:37 AM 0
Share

I haven't seen a Vector2 parameter for Translate before

avatar image ryf9059 · Aug 31, 2013 at 03:41 AM 0
Share

@DESTRU$$anonymous$$TORR I'm using keyboard actually, four arrow keys. I have very little stuff in the program and I have a very powerful computer so I don't think it's the performance issue. Please take a look at the link I provide, run the .exe and you will see what I mean.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by TheValar · Oct 21, 2013 at 06:36 PM

This may be a long shot but try using

transform.position = Vector3.Lerp(startPos, endPos, t); instead of transform.Translate(transVector 5 Time.deltaTime);

obviously you will need to set startPos, endPos, and t appropriatly. Someone suggested this in another post that I read recently.

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

20 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

Related Questions

Smoothing out translation for movement? 0 Answers

Smooth movement using Rigidbody2d 3 Answers

Smooth Camera Movement script with problem. 0 Answers

Move along grid where facing 1 Answer

Object transported to point instead of moving towards it? 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