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 Vortavasail · Sep 05, 2016 at 12:29 AM · rotationspeedworldspacelocal spacelocal velocity

trying to get local forward and side to side values

transform.InverseTransformDirection (rb.velocity); this gives me rotational values ( numbers only change when i rotate the charter transform.InverseTransformDirection (rb.velocity. magnitude); this gives me a float that goes up and down even if i do nothing at all 0.xxxx to 7.xxxx values

and when i turn left right or backwards i animation slows down and dose not play using this its as if i cant

void anim_move () {

     velocity = ((transform.forward - previous).magnitude) / Time.deltaTime;
        // up down  y this is not used  yet but i will think of somthing 
         UDVelocity = ((transform.forward.y - previous.y)) / Time.deltaTime;
        // back forward z
         FBVelocity = ((transform.forward.z - previous.z)) / Time.deltaTime;
        // left right  x
         LRVelocity = ((transform.forward.x - previous.x)) / Time.deltaTime;

        rotaion = gameObject.transform.localRotation.eulerAngles.y;
        rotaion = (rotaion > 180) ? rotaion - 360 : rotaion;


     // this flips the singe so when changing walking directions.
     #region failed attempts to try and fix walking back words if turn around form the starting position i  walking animation is not played.

     if ( rotaion < 0 ) {
            float fliprot = FBVelocity * -1f;
            anim.SetFloat ("Forward" , fliprot);
        } else {    

            anim.SetFloat ("Forward" , FBVelocity);
        
         }
     #endregion
     anim.SetFloat ("Right" , LRVelocity);

     previous = transform.forward;
     }

its as if i'm only reading world space witch i'm sure is the problem but all attempts to read local space fails.

i'm trying to get local speed values forward back left and right up and down and forward is always the way the game object is facing , and pass that info to the animator... i cant seem to get it to work.

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

0 Replies

· Add your reply
  • Sort: 

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

78 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

Related Questions

How to face World Space Canvas to every player in a split-screen game ? 0 Answers

Shortest Rotation Path at Constant Speed 1 Answer

Rotating an object with the mouse and retrieving data 0 Answers

Velocity base on Rotation 1 Answer

Rotate object by Parent Y and Z, but World X? 0 Answers


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