Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Aleks · Dec 01, 2010 at 02:49 PM · cameramovementmouse

Runescape Movement and camera rotation

The Player moves on clicked location by mouse

and Camera to rotate around the player when Left Right Up Down buttons pressed (just like runescape)

This may be difficult, but im sure a lot of people would like this idea

thanks ++

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
1
Best Answer

Answer by The_r0nin · Dec 01, 2010 at 04:23 PM

Try the Unity Script Wiki:

Click to Move

Keyboard Orbit

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
1
Best Answer

Answer by Scribe · Dec 03, 2010 at 07:58 PM

var object : Transform;

function Update () {

if (Input.GetKey(KeyCode.DownArrow)) transform.RotateAround (object.position, Vector3(-1, 0, 0), 20 * Time.deltaTime);

if (Input.GetKey(KeyCode.UpArrow)) transform.RotateAround (object.position, Vector3(1, 0, 0), 20 * Time.deltaTime);

if (Input.GetKey(KeyCode.RightArrow)) transform.RotateAround (object.position, -Vector3.up, 20 * Time.deltaTime);

if (Input.GetKey(KeyCode.LeftArrow)) transform.RotateAround (object.position, Vector3.up, 20 * Time.deltaTime);

}

this is an updated script: set the object that you want to rotate around as the player in the inspector after adding the script to the camera, this will rotate around your players position.

Comment
Add comment · Show 3 · 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 Scribe · Dec 01, 2010 at 07:07 PM 1
Share

function Update () {

if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.DownArrow)) transform.Rotate(1, 0, 0);

if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.UpArrow)) transform.Rotate(-1, 0, 0);

if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.RightArrow)) transform.Rotate(0, 1, 0);

if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.LeftArrow)) transform.Rotate(0, -1, 0);

}

this can be used to rotate the camera just add this script to the main camera unfortuantly although The_r0nin link to click to move will work it will not find a path round obstacles so it will not walk round a building and through the door, it will either walk through the wall (no collider) or keep walking into the wall. the best way to do this is by downloading a pathfinding project like Aron Granberg's pathfinder here

incase the hyperlink didn't work (it sometimes doesn't :P)

http://www.arongranberg.com/unity/a-pathfinding/

avatar image Aleks Scribe · Dec 02, 2010 at 02:08 AM 0
Share

thanks for the answer Scribe but i need a script that the camera rotates like that but around the player. thanks anyway man

avatar image Scribe Scribe · Dec 03, 2010 at 08:00 PM 0
Share

your welcome. I've added a new script below which should rotate around the characters position. hope it helps

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

No one has followed this question yet.

Related Questions

Camera/mouse movement issues "almost but no dice" 1 Answer

Move camera when mouse is on the edge? 1 Answer

Problem with Alt + Middle Click Drag for Camera (Windows) 3 Answers

Get mouse direction in locked 1 Answer

How do I make my character lean to the sides? 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