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 greatUnityGamer · Aug 31, 2013 at 04:06 AM · animationmovementcharacterlocal axis

How to move character Forward on It's own Axis, and not the World Axis?

I used this for a character and then i used it for another character too. They were both facing opposite directions and it was funny. one of them walked forward,and one of them walked backwards.

So i know that it's probably because they're walking using the World axis and not their own.

This is what i used and i attached the script to both characters:

void Update () { transform.position += new Vector3( 0, 0, 0.1f); }

I'm guessing this is the wrong thing to use.

**By the way. I just have the character with a Rigid body. It's not a Character Controller.

*UPDATE. I was looking around in the web and I found transform.Translate(0, 0, 0.02f, Space.Self )

I used it and it kinda works. But the character for some reason starts changing rotation gradually while walking. So i guess maybe this is not a good method to use?

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
3
Best Answer

Answer by DFLY · Aug 31, 2013 at 04:58 AM

 // Move translation along the object's z-axis
      transform.Translate (Vector3.forward * (speed) * Time.deltaTime);
 // speed will be a float variable.
Comment
Add comment · Show 2 · 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 JinPark · Mar 12, 2018 at 04:50 AM 0
Share

I'm a noob, so excuse me. I noticed that the object moves "forward" depending on where it is facing (most likely because of Vector3.forward). But how do you make it move forward on an x/y/z axis regardless of where it is facing?

avatar image DFLY · Mar 18, 2018 at 03:22 PM 0
Share

// $$anonymous$$ove the object upward in world space 1 unit/second. transform.Translate(Vector3.up * Time.deltaTime, Space.World);

I copied this straight out of the manual. Look up "Transform.Translate" in the manual. It gives a full description. But basically you add the space reference to the end. (in this case "Space.World").

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 make your own character. 2 Answers

mystery RestartLevel function used in official tutorial 2 Answers

Character controller + animation of different meshes making one character 1 Answer

Animation Movement 1 Answer

Character Animation Question (Bear Force One) 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