After typing and switching back to the old version, my player controller got messed up, I cannot move from left to right and when I Pressed A or D it goes up and down instead, also when I hit the play button my ship starts from the bottom of the screen instead of the original position. any idea as to why is doing it?
Hi,
What do you mean by ‘switching back to the old version’?
Hello , the Inputsystem version, im currently on the old version and this is the code that I have ( following along the video )
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerControl : MonoBehaviour
{
[SerializeField] float controlSpeed = 5f;
// Update is called once per frame
void Update()
{
float xThrow = Input.GetAxis("Horizontal");
float yThrow = Input.GetAxis("Vertical");
float xOffset = xThrow *Time.deltaTime * controlSpeed;
float newXPos= transform.localPosition.x + xOffset;
float yOffset = xThrow *Time.deltaTime * controlSpeed;
float newYPos= transform.localPosition.y + yOffset;
transform.localPosition = new Vector3
(newXPos,newYPos,transform.localPosition.z);
}
}
Now the issue is that when i press the A key it moves to the left but it goes under and when I press the key D it goes to the right and at the same time it goes up
That’s indeed odd. Have you already tried to add Debug.Logs to your code to see what is going on during runtime? For example, log Input.GetAxis("Horizontal");
into your console to see if you get the expected values when pressing A and D.
I see there’s no value coming out, why is that?
this is my player rig position
and this is my player ship values
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.