I’m trying to create a twin stick control system for a 3rd person game. I tried looking at the scripts for Angry Bots but it was waaay to complicated for my level to decipher, which is a shame as I am actually looking for a very similar control system…
All I want to do at this stage is to have the 3D object move around (backwards, forward, left and right) with the left stick and have the player turn the object around with the right stick, telling it where to look and essentially shoot (also, backwards, forward, left and right - no up and down).
I can move the object, but so far it’s facing only one way… :-/
This is my crude code based on the 3DBuzz tutorial for a 2D shooter:
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public float PlayerSpeed;
// Update is called once per frame
void Update ()
{
// Amount to move
float amtToMoveH = Input.GetAxisRaw("Horizontal") * PlayerSpeed * Time.deltaTime;
float amtToMoveV = Input.GetAxisRaw("Vertical") * PlayerSpeed * Time.deltaTime;
// Move the player sideways and up and down
transform.Translate(Vector3.right * amtToMoveH);
transform.Translate(Vector3.forward * amtToMoveV);
}
}
How can I do it? Preferably in C#?,I’m trying to create a twin stick control system for a 3rd person game. I tried looking at the scripts for Angry Bots but it was waaay to complicated for my level to decipher.
All I want to do at this stage is to have the 3D object move around (backwards, forward, left and right) with the left stick and have the player turn the object around with the right stick, telling it where to look and essentially shoot (also, backwards, forward, left and right - no up and down).
I can move the object, but so far it’s facing only one way… :-/
I can I do it? Preferably in C#?