From 3af4c218c0e70167db23a6303d2af30aff37d2fe Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 20 Aug 2020 23:40:50 -0400 Subject: Removed a bunch of stuff; Changes --- .../Joystick Pack/Examples/JoystickPlayerExample.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Assets/Thirdparty/Joystick Pack/Examples/JoystickPlayerExample.cs (limited to 'Assets/Thirdparty/Joystick Pack/Examples/JoystickPlayerExample.cs') diff --git a/Assets/Thirdparty/Joystick Pack/Examples/JoystickPlayerExample.cs b/Assets/Thirdparty/Joystick Pack/Examples/JoystickPlayerExample.cs new file mode 100644 index 0000000..945a377 --- /dev/null +++ b/Assets/Thirdparty/Joystick Pack/Examples/JoystickPlayerExample.cs @@ -0,0 +1,16 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class JoystickPlayerExample : MonoBehaviour +{ + public float speed; + public VariableJoystick variableJoystick; + public Rigidbody rb; + + public void FixedUpdate() + { + Vector3 direction = Vector3.forward * variableJoystick.Vertical + Vector3.right * variableJoystick.Horizontal; + rb.AddForce(direction * speed * Time.fixedDeltaTime, ForceMode.VelocityChange); + } +} \ No newline at end of file -- cgit v1.2.3