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 Sousai · May 17, 2017 at 02:38 AM · cameramovementcamera movementtargeting

How would one go about creating a Targeting System similar to the z-targeting in LoZ?

I've seen a couple questions ask this but I've yet to see a comprehensive answer.

But, in general, I'm trying to figure out how I would go about coding a camera that would, after selecting a target, position itself behind the player and only allow the play to circle-strafe around that target (This is where I'm stuck).

I need to know how to go about making it so the player, when pressing the left and right movement keys, move in a way that orbits the target instead of how it generally lets them run, without any restraints, to the left and right.

Anyone out there got an explanation or a way I can go about implementing this?

Comment
Add comment · Show 3
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 RobAnthem · May 17, 2017 at 05:39 AM 0
Share

I imagine there is a way that calculates the size of a circle, but I think it may be easier to have a secondary object that gets used as the players position system. Basically when you select the location or target, the object moves to the location, the player gets childed to the object, then his movement gets locked and he can now move differently, where left and right would actually rotate the object. If this doesn't make sense, I suppose I could code an example up.

avatar image NoBrainer-David · May 17, 2017 at 07:45 AM 0
Share

Can you tell us a little bit more about your camera and input set up? For example, is the direction the player character moves relative to itself or to the camera?

In any case, what you can do is find a way to force the player character to look at the target via script. This can be done with the transform.rotation.SetLookRotation, for example. Then, just map the Horizontal input axis to the strafing of the character. This will automatically make the character move in a circle around the target.

avatar image Sousai NoBrainer-David · May 17, 2017 at 09:11 AM 0
Share

THe movement of the character is relative to the camera. And that sounds interesting, I can attempt that later on today.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by CrimOudin · May 19, 2017 at 01:53 PM

If you rotate your character toward the target then their local left and right will change. You can use the local axis' to determine where you will move next.

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 CoughE · May 19, 2017 at 01:57 PM

A simple way to do it, would be make the camera/player LookAt the target. Then after that, only allow the player to move left or right. This way the player will face the target, move to the left and face the target again, effectively orbiting them

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

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

116 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

Related Questions

Camera/can't turn on X 1 Answer

UNITY 3D: How to make the camera follow the player? Smoothly 2 Answers

Camera Follow a Target, but not Centered on it 1 Answer

Mouse movement object in a straight line 2 Answers

Move relative to screen 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