I wanted to adjust the z position of the engine_player when the forward arrow is clicked. My question is how do I access that property of the engine_player prefab attached to the player space ship? Here is the code thus far:
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
private Rigidbody rb;
public float tilt;
public float speed;
public float flameLength;
void Start()
{
rb = GetComponent();
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis(“Horizontal”);
float moveVertical = Input.GetAxis(“Vertical”);
// flameLength = some value between .25 and .75 based on up arrow being pushed
// assign it to the prefab z transform position property
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rb.AddForce(movement * speed);
}
}