• 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
Question by Tessa · May 22, 2012 at 08:25 AM · c#rotationquaternionangleoffset

Location in relation to other objects rotation

Hi,

So I have a person (A). Now I want to set the location of a second person (B) that should be standing in a certain position in relation to A. Like this:

(^ means a person that's looking in that direction)

 ---^---
 -----^-

So the second person is standing behind the other person at a given angle (135 degrees) at a given distance (x). His rotation is the same. What I want to find is the location of person B. I can't for the life of me figure out how to calculate this from A's quaternion (or what keywords to google for ^.^), even though I realise it's relatively simple o.O.

Thanks!

Comment

People who like this

0 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 amirabiri · May 22, 2012 at 08:38 AM 0
Share

In this in Unity..? Why can't you access the position of person B?

avatar image Tessa · May 22, 2012 at 08:41 AM 0
Share

I want to set his position. I don't know how to calculate what coordinates that should be though.

edited the question to make that more clear :)

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by amirabiri · May 22, 2012 at 08:48 AM

OK now that I understand the question, the answer is that you should look at the methods on the Transform class such as TransformDirection, TransformPoint. The methods of the Transform class cover all cases of translating between local and world coordinates, which is essentially what you are trying to do here.

As a rule of thumb, unless you absolutely have too it's better not to go head-to-head with the rotation Quaternion. As you just discovered, she can bite.

Comment
Tessa
BiG
Fattie

People who like this

3 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 Tessa · May 22, 2012 at 08:54 AM 0
Share

Ah, didn't realise Unity took so much work from me :). (New to it ;)). Thanks!

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

Flip over an object (smooth transition) 3 Answers

object is not rotating from right direction 0 Answers

how do i take gyro rotation and multiply it? 1 Answer

How to set rotation.y to predefined angles. 3 Answers

Measure rotation as a gyroscope does (without a real gyroscope) 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