How to implement android touch input joysticks for the lego microgame

So I have been messing around with customizing the Lego microgame. I am a fairly new user, and I think it is a fun way to learn the ins and outs (Plus my son is learning along with me and it keeps him interested).
In some previous projects I used android touch input by using this method:

Where you add the joysticks and then code them as input to replace the input (with simpleinput from the asset store) on the player controller. So I have added the joysticks and I am looking around and the player movement seems to be a bit more complicated than what I have worked with before. Can someone please help me out with what code I would need to change in order to change the movement and look to left and right joysticks and the jump to a button on my canvas? I would really appreciate that and would be a major bonus if someone helps me understand the special movements that I can see in the controller script but am not sure how to enable or use. If it matters, I am using unity 2019.4.11f1 personal.
NOTE: In the following code from minifigcontroller.cs I tried changing Input.GetAxisRaw() to SImpleInput.GetAxisRaw() and then I get an error saying The name ‘SimpleInput’ does not exist in the current context. Thanks for any help.

// Handle input.
            if (inputEnabled)
            {
                switch (inputType)
                {
                    case InputType.Tank:
                        {
                            // Calculate speed.
                            var targetSpeed = SimpleInput.GetAxisRaw("Vertical");
                            targetSpeed *= targetSpeed > 0 ? maxForwardSpeed : maxBackwardSpeed;
                            if (targetSpeed > speed)
                            {
                                speed = Mathf.Min(targetSpeed, speed + acceleration * Time.deltaTime);
                            }
                            else if (targetSpeed < speed)
                            {
                                speed = Mathf.Max(targetSpeed, speed - acceleration * Time.deltaTime);
                            }

                            // Calculate rotation speed.
                            var targetRotateSpeed = SimpleInput.GetAxisRaw("Horizontal");
                            targetRotateSpeed *= maxRotateSpeed;
                            if (targetRotateSpeed > rotateSpeed)
                            {
                                rotateSpeed = Mathf.Min(targetRotateSpeed, rotateSpeed + rotateAcceleration * Time.deltaTime);
                            }
                            else if (targetRotateSpeed < rotateSpeed)
                            {
                                rotateSpeed = Mathf.Max(targetRotateSpeed, rotateSpeed - rotateAcceleration * Time.deltaTime);
                            }

                            // Calculate move delta.
                            moveDelta = new Vector3(0, moveDelta.y, speed);
                            moveDelta = transform.TransformDirection(moveDelta);
                            break;
                        }
                    case InputType.Direct:
                        {
                            // Calculate direct speed and speed.
                            var right = Vector3.right;
                            var forward = Vector3.forward;
                            if (Camera.main)
                            {
                                right = Camera.main.transform.right;
                                right.y = 0.0f;
                                right.Normalize();
                                forward = Camera.main.transform.forward;
                                forward.y = 0.0f;
                                forward.Normalize();
                            }

                            var targetSpeed = right * SimpleInput.GetAxisRaw("Horizontal");
                            targetSpeed += forward * SimpleInput.GetAxisRaw("Vertical");
                            if (targetSpeed.sqrMagnitude > 0.0f)
                            {
                                targetSpeed.Normalize();
                            }
                            targetSpeed *= maxForwardSpeed;

                            var speedDiff = targetSpeed - directSpeed;
                            if (speedDiff.sqrMagnitude < acceleration * acceleration * Time.deltaTime * Time.deltaTime)
                            {
                                directSpeed = targetSpeed;
                            }
                            else if (speedDiff.sqrMagnitude > 0.0f)
                            {
                                speedDiff.Normalize();

                                directSpeed += speedDiff * acceleration * Time.deltaTime;
                            }
                            speed = directSpeed.magnitude;

                            // Calculate rotation speed - ignore rotate acceleration.
                            rotateSpeed = 0.0f;
                            if (targetSpeed.sqrMagnitude > 0.0f)
                            {
                                var localTargetSpeed = transform.InverseTransformDirection(targetSpeed);
                                var angleDiff = Vector3.SignedAngle(Vector3.forward, localTargetSpeed.normalized, Vector3.up);

                                if (angleDiff > 0.0f)
                                {
                                    rotateSpeed = maxRotateSpeed;
                                }
                                else if (angleDiff < 0.0f)
                                {
                                    rotateSpeed = -maxRotateSpeed;
                                }

                                // Assumes that x > NaN is false - otherwise we need to guard against Time.deltaTime being zero.
                                if (Mathf.Abs(rotateSpeed) > Mathf.Abs(angleDiff) / Time.deltaTime)
                                {
                                    rotateSpeed = angleDiff / Time.deltaTime;
                                }
                            }

                            // Calculate move delta.
                            moveDelta = new Vector3(directSpeed.x, moveDelta.y, directSpeed.z);
                            break;
                        }
                }

I have just make it work:

Add from the assets store the joystick pack.

  1. on the project view, move the joystick pack folder from assets to asster/LEGO/scripts/LEGO Minifig
  2. the joystick pack folder is with the same folder as the MinifigController c# file.
  3. open minifigController code file, and add public var:

public FixedJoystick joystick;
now edit the lines
var targetSpeed = right joystick.Horizontal;
targetSpeed += forward joystick.Vertical; within case InputType.Direct:

  1. add a new canvas and add into this canvas an Fixed Joystcik.
  2. select the Pizza Boy and in the inspector select the Minifig Controller and select the joystick to be the joystick you made in section 4.

works for me :slight_smile:

Use the Standards Assets pack from unity