Search Unity

How to create 3d spinning character selection menu

Discussion in 'General Discussion' started by Carrmichaelll, Aug 5, 2019.

  1. Carrmichaelll

    Carrmichaelll

    Joined:
    Nov 30, 2016
    Posts:
    68
    Hey guys, i'd appreciate it if anyone could direct me to any resource that explains how to achieve this character selection style, haven't been able to successfully find any.
    thanks in advance
     

    Attached Files:

  2. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    I don't know of any scripts available for free anywhere (damn I miss those days) but there's one on the asset store that seems to be what you're looking for. I bought it to put into a game (though didn't end up using it) and I'm pretty sure it will cover the type of selection you want.

    Here's the link: https://assetstore.unity.com/packages/templates/systems/ultimate-selector-55454
     
    Carrmichaelll likes this.
  3. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,157
    What have you tried so far and why didn't that work?
     
    MadeFromPolygons and Billy4184 like this.
  4. Carrmichaelll

    Carrmichaelll

    Joined:
    Nov 30, 2016
    Posts:
    68
    thanks for this resource, I think I understand what they did here, i'm going to copy their technique lol
     
    Ony likes this.
  5. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,023
    A good way to approach problems like this is to break it down into small components. There's nothing complicated at all going on there. Create an array of characters. Select a character by index. Scale selected character up, scale other characters down. And so on. If this sounds too hard, it's probably time to hit up the Learn section.
     
  6. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,190
    Cinemachine can handle the movement of the objects if you want a complex movement pattern. You start by creating a path with the CinemachinePath or CinemachineSmoothPath components.

    https://docs.unity3d.com/Packages/com.unity.cinemachine@2.3/manual/CinemachineDolly.html
    https://docs.unity3d.com/Packages/com.unity.cinemachine@2.3/manual/CinemachinePath.html
    https://docs.unity3d.com/Packages/com.unity.cinemachine@2.3/manual/CinemachineSmoothPath.html

    From there you take the objects you want on the path, attach CinemachineDollyCart to them and drag the path into the dolly cart's path property on the Inspector.

    https://docs.unity3d.com/Packages/com.unity.cinemachine@2.3/manual/CinemachineDollyCart.html

    After that you can simply adjust the dolly's position to move it around the path, and have a script that scales the object up/down when it's in/out of the desired position range.

    Below are example scripts written in notepad that have had no testing or debugging but should show how to get started with creating the scripts necessary to move carts (placed on an object that the dollies are all children of) and scale them (placed on the objects with the cart component).

    Code (csharp):
    1. using UnityEngine;
    2. using UnityEngine.Cinemachine;
    3.  
    4. public class MoveCarts : MonoBehaviour
    5. {
    6.     void Update()
    7.     {
    8.         float movement = Input.GetAxis("Horizontal") * Time.deltaTime;
    9.         if (!Mathf.Approximately(movement, 0.0))
    10.         {
    11.             foreach (CinemachineDollyCart cart in GetComponentsInChildren<CinemachineDollyCart>())
    12.                 cart.position += movement;
    13.         }
    14.     }
    15. }

    Code (csharp):
    1. using UnityEngine;
    2. using UnityEngine.Cinemachine;
    3.  
    4. public class ScaleMe : MonoBehaviour
    5. {
    6.     public float positionMin;
    7.     public float positionMax;
    8.  
    9.     private Vector3 originalScale;
    10.  
    11.     private CinemachineDollyCart cart;
    12.  
    13.     void Start()
    14.     {
    15.         originalScale = transform.localScale;
    16.         cart = GetComponent<CinemachineDollyCart>();
    17.     }
    18.  
    19.     void Update()
    20.     {
    21.         if (cart.position > positionMin && cart.position < positionMax)
    22.             transform.localScale = new Vector3(originalScale.x * 2, originalScale.y * 2, originalScale.z * 2);
    23.         else
    24.             transform.localScale = originalScale;
    25.     }
    26. }
     
    Last edited: Aug 7, 2019
    MadeFromPolygons likes this.
  7. Carrmichaelll

    Carrmichaelll

    Joined:
    Nov 30, 2016
    Posts:
    68
    Thanks for all the help Guys, I got it working!...... this is the effect i was trying to achieve
     

    Attached Files:

  8. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    Hmm, can't decide if I'd choose Batman, Black Panther, or Darth Vader.
     
    Martin_H likes this.
  9. brianmcgee

    brianmcgee

    Joined:
    Dec 12, 2019
    Posts:
    1
    So what was the actual answer? Did you use the Cinemachine?
     
  10. Carrmichaelll

    Carrmichaelll

    Joined:
    Nov 30, 2016
    Posts:
    68
    no, i used this tutorial and customized it to my needs
     
    Last edited: Dec 13, 2019
  11. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    You could probably force this old tutorial of mine into doing the job. No guarantees the code still works as written though, Unity has been through a lot of changes since then.

     
  12. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,157
    What tutorial?
     
  13. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    that one.
     
  14. Carrmichaelll

    Carrmichaelll

    Joined:
    Nov 30, 2016
    Posts:
    68
    just edited my response and posted the link, didn't realize i didnt post it before lol

    p.s to avoid some bugs make sure you turn off inertia in the scroll rect component, and make sure the panel/image component responsible for receiving your mouse events occupies the entire camera frostrum or completely covers camera far clip plane, or just stretch the rect transform's anchor preset accross the canvas
     
    Last edited: Dec 13, 2019