Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How do i make a working gumball machine?

Hey Everybody,

I like gum and if you don't then, why? But, I really want to know how to make a working gumball machine! Thank you.

From,

Pandi.

Answers

  • Hope this helps!

  • WarpWarp Administrator

    If you're not joking, and want to make one in Unity, here is how to do that:

    1. Download blender or something, and create a gumball machine model
    2. Create an animation in blender of the gumball falling down
    3. Import it into Unity, and use the Animator class to animate it.

    Good luck!

  • @Mouledoux that was not it but okay, here is the code

    using UnityEngine;


    public class GumballSpawner : MonoBehaviour

    {

      public GameObject Gumball;

      public float speed = 1f;


      // Update is called once per frame

      void Update()

      {

        if (Input.GetKeyDown(KeyCode.E))

        {

          GameObject instGumball = Instantiate(Gumball, transform.position, Quaternion.identity) as GameObject;

          Rigidbody instGumballRigidbody = instGumball.GetComponent<Rigidbody>();

          instGumballRigidbody.AddForce(Vector3.forward * speed);

        }

      }

    }

  • Looks good 👍️

    Keep up the good work.

Sign In or Register to comment.