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 jampakdd · Jun 17, 2015 at 07:25 PM · cameramovementcontrollerthird-personorbit

3rd person camera/movement

Hey guys I'm a new game maker here and I have all the skills I need to make the game look nice except for the coding aspect... What I am attempting to make is a 3rd person game with movement much like GTA 5 and I have been searching for a solution for a while. I figure it will be hard to make the player and the camera orbit separately but this is the kind of camera that is necessary for my game... I don't want videos showing me this at work. I need someone who can walk me through the process of coding all of it so I can customize it to my game. If anyone would like to help me with this project more I would love to talk because I basically know nothing about coding except how to read it and simple things I will need to customize it. Thank you for your time! -Skylar

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 $$anonymous$$ · Jun 17, 2015 at 09:56 PM 0
Share

I would recommend taking a look at the Bootcamp tutorial, or if you want to dig through the guts of some code, the first person controller stock prefab? Sorry If I'm not much help, but good luck!

avatar image jampakdd · Jun 17, 2015 at 10:27 PM 0
Share

Thanks ill do that! I tried pecking at the newest prefab but its just not what I'm looking for and $$anonymous$$y skills with coding are just not advanced enough to change it to what I want... also it doesn't have any camera modal I could use which is a large part of how I want the character to move...

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Tekksin · Jun 17, 2015 at 10:37 PM

Third person cameras are pretty simple. Just make a camera and then make it a child of your player. Position it at the height and angle you see fit. It'll follow the player around. Moving the camera independently of the player's look-rotation is a different story though:

If you wanna go that route, you can trick unity. Just make a player, then make an empty gameobject and make that empty obj a child of the player. Then make the camera and make that a child of the empty gameobject.

player > empty > camera.

Then have the camera follow the empty gameobject. When you use the right thumbstick to pan the camera, or the mouse pointer to aim it elsewhere--however you wanna control that--have the empty begin to rotate. This way your player's rotation stays the same. Subsequently, it'll follow the player all the same because it's following the empty that is a child of the player.

Comment
Add comment · 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 adamsonbenjamin · Jan 17, 2017 at 01:52 PM 0
Share

Thank you, years later this answer is still helpful. Cheers

avatar image
0

Answer by shadowunity3d · Jun 09, 2017 at 06:42 AM

Here is my answer and it works perfectly: Moves forward, Rotates and Collides with Other objects (Having RigidBody and Box/Capsule Collider). tThis is based from Burkhard's answer.

But befor all do this : Create an empty Object set it a child of your Player and drag your camera Object into your empty Object.

NB : You can place the camera behind your player to get a best view.

using System.Collections; using System.Collections.Generic; using UnityEngine;

   public class CubeControl : MonoBehaviour {
 
     public float speed = 10.0f;
     Rigidbody rb;
     GameObject playerEmpty;
     // Use this for initialization
     void Start () {
 
         rb = GetComponent<Rigidbody> ();
 
     }
     
     // Update is called once per frame
     void Update () {
 
         float Haxis = Input.GetAxis ("Horizontal");
         float Vaxis = Input.GetAxis ("Vertical");
  
          
         //Go Forward
         if(Input.GetKeyDown(KeyCode.UpArrow))
             {
 
                 //Works perfectly but does no longer collide
                 //rb.transform.position += transform.forward * Time.deltaTime * 10.0f;
                //Not moving in the right direction
                 //rb.velocity += Vector3.forward * 5.0f;
 
 
               rb.velocity += Camera.main.transform.forward * speed;
 
             //rb.rotation() += new Vector3 (0.0f, headingAngle, 0.0f) * 5.0f;
             //rb.velocity += gameObject.transform.localEulerAngles * Time.deltaTime * 10.0f ; 
             }
         if(Input.GetKeyDown(KeyCode.DownArrow))
             {
                 rb.velocity -= Camera.main.transform.forward * speed;
             }     
             Vector3 rotationAmount = Vector3.Lerp(Vector3.zero, new Vector3(0f, 10.0f * (Haxis < 0f ? -1f : 1f), 0f), Mathf.Abs(Haxis));
             Quaternion deltaRotation = Quaternion.Euler(rotationAmount * Time.deltaTime);
             this.transform.rotation = (this.transform.rotation * deltaRotation);
     
     }
 }

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Orbit around an object 0 Answers

3rd person controller 0 Answers

3rd person controller camera passing through walls 0 Answers

3rd person player 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