• 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 TheBoski · Aug 18, 2016 at 02:21 PM · vector3valueanglesmodify

Calculate Vector3 based on the other Vector3

Hello fellow programmers!

So in my game I have two virtual joysticks each returning a Vector3 value representing the direction in w$$anonymous$$ch the joys are pushed.

One of the joysticks is located on the left , and the second one is on the right side of the screen. Let's call return values accordingly : Left Vector (LV) and Right Vector (RV).

My problem is that the Left Vector needs to be modified based on the input from the right joystick. What I mean is that angle between LV and RV needs to be maintained as it is, and the Right Vector should be treated like Vector3.up by the left joy.

I hope t$$anonymous$$s quick sketch will make it easier to understand :

alt text

It is worth noting that the green arrow representing RV in the "HOW IT SHOULD BE" section is there only to show maintained angle between two Vectors. There is no need to physically change the direction of Right Vector.

I only need to get the changed direction of the Left Vector

It is a shot in the dark but maybe I can measure the angle between Right Vector and Vector3.up , then somehow add that angle to the Left Vector ? (I really don't know how it works in Unity)

Is there a function provided by Unity to do such tasks or I am completely wrong and I need a better approach?

Please help me with solving t$$anonymous$$s issue. T$$anonymous$$s is a part of my first kind of a serious project and without your help i may get stuck forever :(

Also, I'm sorry for any spelling mistakes I made since English is shamefully not my first language.

vector-problem.jpg (56.8 kB)
Comment
Add comment · Show 2
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 g__l · Aug 18, 2016 at 03:43 PM 0
Share
avatar image meat5000 ♦ · Aug 18, 2016 at 04:46 PM 0
Share

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Obtain angle from given rotation 1 Answer

How to detect if player is facing towards enemy's back 2 Answers

How to catch a Vector3-value by clicking at a world position in editor mode? 2 Answers

How to stop scale reducing from reaching Zero (Solved) 1 Answer

Need help setting a vector behind a character 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