• 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 DustySkunk · May 17, 2015 at 07:43 PM · mathvectorcharacter movementlocalrotationworld coordinates

[Vectors] Moving towards a specific point on the XY plane by only rotating about object's local Y axis and translating along its Z axis

Hello all,

I've got a bit of a conundrum and I'm hoping someone might be able to point me in the right direction involving vector math. I recently implemented a character movement solution found here:

http://answers.unity3d.com/questions/155907/basic-movement-walking-on-walls.html

Before I go any further the reason I am posting this as an entirely new question rather than as a comment on that thread is that I feel like my question is different enough to justify its own topic.

This movement solution rotates the character about its local Y axis and then moves/translates it forwards and backwards along its Z axis all the while keeping the characters "gravity" pointed towards the nearest terrain object. This is fine control scheme for a third person viewpoint.... However, in my project there are sequences in which the camera pulls back to be normal to the XY plane with the Z axis traversing "through" the camera's view. Essentially, the game has segments where it turns into a 2.5D platformer. When this happens, I would ideally like the player to control their character just as if it was a platformer in which joystick movements don't represent a rotation and a velocity, but a target in world space the character moves towards while maintaining its orientation in relation to the object it's "stuck" to. Also, the character's movement is constrained from to the XY plane.

I've attempted to create a diagram to illustrate the above:

alt text

If it wasn't clear, the cylinder represents the player character.

So, what I'm looking for is an elegant way to turn the player's joystick movements (representing a target vector in world space) in the 2.5D platforming section into a rotation about the character's local y and velocity along Z.

The problem is simplified a bit in that in the platforming sections, the character need only face sideways to the camera.

I've been trying to convert the vector created by the joystick axis inputs into a local target for the character, but have been failing spectacularly. Any help or advice would be appreciated, preferably in C#.

Thank you all so much in advance for you help regarding this problem

conundrum.png (46.0 kB)
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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Random Rotation To Animation HELP! 2 Answers

Can I use the local x,y transforms of a plane? 1 Answer

CharacterController on Moving Surface 4 Answers

Move Vectors as curve towards Target 1 Answer

How to get a vector3 (postion) 1 unit away from another in the direction of a 3rd vector3? 2 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