- Home /
Katamari/RC car controls for dual analogue sticks
I'm a beginner and I'm looking to make something that has Katamari style controls (or some type or RC car control system). The Left stick up steers right, Right stick up steers left, and both Left and Right sticks up make the object go forward. This code almost has the effect I want, but the issue is with the forward motion being too fast because its adding both the moveSpeedR and moveSpeedL multipliers together. I want to add some kind of speed restriction that I can customise, or something that cancels these variables out.
I hope I've made sense, I'd be very great full if someone could provide some advice.
Thanks.
private float turnSpeedL;
private float turnSpeedR;
private float moveSpeedL;
private float moveSpeedR;
void Update()
{
PlayerMove();
}
void PlayerMove()
{
float turnR = Input.GetAxis("LeftStickVertical");
float turnL = Input.GetAxis("RightStickVertical");
transform.Translate(new Vector3(0, 0, 1) * turnR * moveSpeedR * Time.deltaTime);
transform.Rotate(new Vector3(0, 1, 0) * turnR * turnSpeedR * Time.deltaTime);
transform.Translate(new Vector3(0, 0, 1) * turnL * moveSpeedL * Time.deltaTime);
transform.Rotate(new Vector3(0, -1, 0) * turnL * turnSpeedL * Time.deltaTime);
}
Your answer
Follow this Question
Related Questions
How to get different objects with same script to act independently? 2 Answers
I have a movement script, but how can i make it so i can move half the speed while in the air. 0 Answers
Character Transform shifting after colliding with objects 0 Answers
Rigidbody Player Controller sticking to walls 0 Answers
Player can't move left or right while holding W and S at the same time - No code making it do that? 2 Answers