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 igorshemi · Feb 07, 2014 at 10:05 PM · javascriptmove an objecttransform.translate

Transform.Translate Does not work correctly

I do not understand what the problem is. Cube. Start position: (6.75, 1.5, 18.875). If y>=2 - it work Not set rigidbody.

 var moveSpeed : float = 0.1;
 
 function Update () {
     translation = Time.deltaTime * moveSpeed;
     transform.Translate(new Vector3(1.8,1,13.9) * translation);//The problem in this line
 }
 

Motion map

transform.Translate(new Vector3(1.8,1,13.9) * translation);-move

transform.Translate(new Vector3(1.8,1,-13.9) * translation);-move

transform.Translate(new Vector3(1.8,-1,13.9) * translation);-move

transform.Translate(new Vector3(1.8,-1,-13.9) * translation);-move

transform.Translate(new Vector3(-1.8,1,13.9) * translation);-move

transform.Translate(new Vector3(-1.8,1,-13.9) * translation);-not move

transform.Translate(new Vector3(-1.8,-1,13.9) * translation);-move

transform.Translate(new Vector3(-1.8,-1,-13.9) * translation);-not move

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 robertbu · Feb 07, 2014 at 10:08 PM 1
Share

It is unclear here what you are looking at in terms of expected behavior. Assu$$anonymous$$g this is the only movement script on the block, it will will use Vector3(1.8,1,13.9) as the direction vector for movement, and it will move in that direction at the rate of 0.1 units per second. Note the code above will not compile because 'translation' is not declared.

avatar image igorshemi · Feb 08, 2014 at 06:03 AM 0
Share

I [First Person Controller+$$anonymous$$ouseLook+Character$$anonymous$$otor+FPSInputController, position(1,2,1), scale(1,1,1), height=0.5] look at the expected behavior, standing on a stationary cube position(1,1.5,1), scale(2,0.25,3).

This is the only movement script on the block.

$$anonymous$$ore a function start (), but it's empty.

 function Start () {

 }
avatar image robertbu · Feb 08, 2014 at 06:17 AM 0
Share

Well there is nothing in this script that would have inconsistent behavior...that is it would not change it behavior just because y >= 2. Something else is impacting this cube...a collision for example or another script.

avatar image Benproductions1 · Feb 08, 2014 at 11:25 AM 0
Share

@robertbu, Sorry for nitpicking but it won't move at the rate of 0.1 units per second. It will move at the ever so weird 0.1*sqrt(197.45) u/s approximately equivalent to 1.406 u/s :P

@igorshemi It would be beneficial both to yourself and anyone else reading your code if those vector values were explained in a comment.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by igorshemi · Feb 09, 2014 at 11:56 AM

Sorry. Found a bug: the old project used as the template. Although itself a mistake and did not find, but in pure project - everything works as expected.

Topic can be closed

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

19 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

Related Questions

How to move a Child independently to another object and back. 1 Answer

Moving object to specific location 1 Answer

GameObject won't move with transform.translate or rigidbody2d.moveposition,GameObject won't move in void Start() 1 Answer

How do I find out where a child is with javascript 3 Answers

Move Camera only along y and z axis, but not both? 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