Argon Assault Jet Moves Global X instead of Local X?

Jet flies straight forward instead of to the right. I was using “both” new and old Input Systems, then I uninstalled the new one to just use the old. Didn’t fix it. The code has transform.localPosition.x so it looks right, and is hard for me to guess what’s wrong.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class JetMover2 : MonoBehaviour
{

// Update is called once per frame
void Update()
{
    MovePlayer();
}

private void MovePlayer()
{
    float xThrow = Input.GetAxis("Horizontal") * Time.deltaTime;
    float yThrow = Input.GetAxis("Vertical") * Time.deltaTime;
    Debug.Log(xThrow);
    Debug.Log(yThrow);

    ///float yVal = Input.GetAxis("Vertical") * Time.deltaTime * movespeed;
    //float zVal = Input.GetAxis("Horizontal") * Time.deltaTime * movespeed;

//transform.Translate(0, yVal, zVal);
/*
float horizontalThrow = Input.GetAxis(“Horizontal”);
float verticalThrow = Input.GetAxis(“Vertical”);
*/

    float movespeed = .1f;
    float newXpos = transform.localPosition.x + movespeed;

    transform.localPosition = new Vector3
        (newXpos, 
        transform.localPosition.y, 
        transform.localPosition.z);
}

}

I figured it out. The player rig and player rotations were offset by 90 degrees, so I had to align them and redo the animations, but it works now.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms