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 /
avatar image
0
Question by vijay_unity225 · Nov 24, 2018 at 01:17 PM · movementcontrollerplayer movement

How to get player strafing movement with look at Enemy and relative to camera direction???

How to get player strafing movement with look at Enemy and relative to camera direction??? but not in circular movement. simply like prince of POP WW game player movement. Im able to create freestyle movement and freestyle strafing but unable to do non circular movement with look at rotation Please somebody help me!!

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
0

Answer by Vinz3d · Apr 10, 2020 at 08:35 PM

I'm having the same issue and going crazy over maths.. if since then you've found the solution? That'd be a great help! :)

Cheers!

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
avatar image
0

Answer by ShamusO · Apr 10, 2020 at 08:37 PM

Can you please upload a short clip of what's happening? Also can you post some examples of your code?

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 Vinz3d · Apr 11, 2020 at 09:25 AM 0
Share

Sure, find here a link to a gif: https://drive.google.com/file/d/1Cv$$anonymous$$LP6XtxvtaRHOzo9kbdPGzxrBsF2zH/view

As you'll see, I've got normal movement and aim/strafe movement. The issue I'm having is translating horizontal/vertical floats to the strafe animations. If the camera was locked behind as a 3rd person view, it'd be fine (as you can see when the player is going forward) but the game is a VR platformer which means I need to find a way to bring the angle offset from camera-player to the h and v strafe values with h and v inputs. I'm not super confortable with C# yet and haven't found any luck so far.

  private void Ai$$anonymous$$g$$anonymous$$ove(Vector3 movement)
     {
         // TODO Find a way to clamp the vectors for keyboard diagonals without normalizing
         Vector3 desiredDirection = (cameraRoot.transform.forward) * movement.y + (cameraRoot.transform.right) * movement.x;
         transform.Translate(desiredDirection * 4f * speed * Time.deltaTime, Space.World);
         // 
         oldRot = transform.rotation;
     }
 
 private void Ai$$anonymous$$g$$anonymous$$oveAnim(Vector3 movement)
     {
         if (Is$$anonymous$$oving(movement))
         {
             anim.SetBool("useStrafe", true);
             anim.SetFloat("strafe_h", movement.x); // should have something including movement.y as well
             anim.SetFloat("strafe_v", movement.y); // should have something including movement.x as well
         }
         else
            anim.SetBool("useStrafe", false);
     }

Also movement are my axis inputs

movement = playerInput.movementInput;

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

153 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 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

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Move Object a direction with one button and move the object back with the same button? 1 Answer

Player Movement 0 Answers

All Unity Engine games' controls not working 1 Answer

Help with my Dash move? 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