Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Roll A Ball Question: How to change the camera so it follows like a 3d platformer?

Discussion in 'Getting Started' started by ikarus2012, Jun 12, 2017.

  1. ikarus2012

    ikarus2012

    Joined:
    Aug 9, 2016
    Posts:
    21
    I'm onto something, I imported the standard assest's project with camera scripts. I just don't know where a good tutorial on youtube is, or how to edit the options and scripting to [connect the camera and the player].

    If I were to remove the ball or set the camera further back. I could then use the roll a ball level, and have an extended idea to work with.

    Thanks
     
  2. ikarus2012

    ikarus2012

    Joined:
    Aug 9, 2016
    Posts:
    21
    Updated: Dragging the camera script options, from the import assests. I have attached a camera without making it myself.

    The better question is - how do I find a camera where it will pivot all axis'?​

    I'd like to see the whole map as I follow the roll-a-ball, not just a 180
     
  3. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    When you say "Pivot all axis" do you mean that you want to be able to rotate the camera similar ot a 1st/3rd person game and look everywhere?

    Also, you mentioned about not finding any good tutorials... what exactly are you after? Perhaps I can point to one that deals with your specific queries...

    Of course I would recommend going through ALL the tutorials that are available on this site as they can all teach your something useful in your fledgling projects.
     
  4. ikarus2012

    ikarus2012

    Joined:
    Aug 9, 2016
    Posts:
    21
    I was meaning something that could be able to follow it like super monkey ball for the GameCube.
     
  5. ikarus2012

    ikarus2012

    Joined:
    Aug 9, 2016
    Posts:
    21
    (Third Person Fixed but dynamic and free following camera)
     
  6. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    411
    Still not sure if I'm following you, but I'll try to help make something that's similar to super monkey ball.

    • Take your basic main camera.
    • Add a new script.
    • Have something like the following in the new script:
      Code (CSharp):
      1. using System.Collections;
      2. using System.Collections.Generic;
      3. using UnityEngine;
      4.  
      5. public class PlayerFollowScript : MonoBehaviour {
      6.  
      7.     public GameObject player;
      8.  
      9.     public float followDistance;
      10.     public float followHeight;
      11.  
      12.     // Use this for initialization
      13.     void Start () {
      14.        
      15.     }
      16.    
      17.     // Update is called once per frame
      18.     void Update () {
      19.         Vector3 newPos = player.transform.position + (-player.transform.forward * followDistance);
      20.  
      21.         newPos.y = followHeight;
      22.  
      23.         transform.position = newPos;
      24.  
      25.         transform.LookAt(player.transform.position);
      26.     }
      27. }
    • Back in the inspector, drag the player object to the new "Player" field for the script.
    • I'd recommend setting the followDistance and followHeight to 15 and 10 respectively.
    Every frame the camera will do the following

    • Get the players location in the game and move behind the player by whatever you've set the distance to. (This is done by using "-player.transform.forward" - leaving out the minus will set the camera in front of the player.)
    • Set's the cameras height to whatever you wanted it to. NOTE: if you're going to have the player on a non-flat direciton of play then you will have to change this.
    • Finally, look directly at the player.
    Hope this helps. All the best.

    P.S. You could try searching for 3rd person game tutorials - this SHOULD provide some of the basic tips for a Super Monkey Ball type camera.
     
  7. ikarus2012

    ikarus2012

    Joined:
    Aug 9, 2016
    Posts:
    21
    Ill bookmark this, as this will hopefully solve the problem



    ubi sububi
     
    Tset_Tsyung likes this.