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 Gyrant · Mar 20, 2011 at 05:30 PM · camerathird-personview

How do I make a simple, 3rd person RPG-type camera behavior?

Hello! I'm a graphic artist, long time gamer excited and anxious to get into game development. Art and design are totally my thing but I hardly know squat about code and programming.

I'm putting together a 3rd-person RPG type of game and I want my camera to behave like an ordinaly, common 3rd person RPG type camera. How do I accomplish that?

A great example of the type of camera behavior I am looking for could be Legend of Zelda:OOT, Conker's BFD, Ninja Gaiden, GTA:Vice City, True Crime, etc, I am sure I could dig up a lot more if that is not helpful.

Otherwise the only way I could describe it is by referring to real-world mechanics. Imagine an elastic tether connecting the camera to the character. The camera stays fixed on the character but only moves when the characters runs away and tugs on the tether.

The SmoothFollow script would be okay except that it snaps behind the character. Lowering the damnp rotation fixes that, but then the camera hardly rotates at all. I'd like the camera to rotate to track the character and only move when the character moves away, but then only move near the character again, not snap to the back of the character as in the SmoothFollow script.

It is an insanely common and popular camera control style in RPGs but I am having hell finding the proper way to re-create it. Please, please do not respond with, "Google it." I have been googling it, youtubing it, UnityWiki-ing it, redditing it, I've probably tried a dozen different scripts not including my own butcher-coding of putting together the bits and pieces of script that I thought would get the job done and crossing my fingers for it to work.

Thank you in advance to anyone who can help me out! -Gyrant

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 Statement · Mar 20, 2011 at 06:04 PM 0
Share

Are you using UnityScript (JS) or C#?

avatar image Gyrant · Mar 20, 2011 at 06:07 PM 0
Share

All of the scripting I am using so far is JS, since it seems to be the most popular language for use in Unity3D.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by TehWardy · Mar 20, 2013 at 11:48 PM

the closest i came to getting this working (from a quick try this evening) was to do the following ...

  1. add third person controller to scene

  2. select camera

  3. add mouse orbit script to camera

  4. drag and drop 3rd person controller on to "target" of mouse orbit script edit the mouse orbit script ...

    function LateUpdate () { if (target && Input.GetMouseButton(1)) { x += Input.GetAxis("Mouse X") xSpeed 0.02; y -= Input.GetAxis("Mouse Y") ySpeed 0.02;

            y = ClampAngle(y, yMinLimit, yMaxLimit);
         }
         
         var rotation = Quaternion.Euler(y, x, 0);
         var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
         
         transform.rotation = rotation;
         transform.position = position;
     }
    
    

That sort of does it ... the idea being that the camera now follows the player and when the right mouse button is held down moving the mouse rotates the camera.

It does this odd jumpy thing though (the camera acts like its constantly being nudged) a tiny bit each frame ... I get the impression theres a better way to do this or maybe smoothing might help but that's the idea right?

So close !!!

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

1 Person is following this question.

avatar image

Related Questions

How do i combine first and third person views? 1 Answer

How do I calculate a view matrix using Matrix4x4.LookAt? 2 Answers

Turn with the mouse instead of with the camera 0 Answers

How do I make a third person camera toggle that doesn't snap? 0 Answers

Change camera when holding right mouse button 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