Hello, I'm a bit of a newcomer in adventure creator and in unity. I'm having trouble making a treadmill or moving walkway script (something that will constantly push the player along a given (1,0,0) axis) in 3d, first person.
What i have right now is this:
using AC;
using UnityEngine;
public class MovingWalkway : MonoBehaviour
{
public Vector3 movementDirection = new Vector3(1, 0, 0); // Move along X-axis
[SerializeField] float speed = 5f; // Adjust speed in Inspector
private void OnTriggerStay(Collider other)
{
if (other.CompareTag("Player")) // Check if the object is the player
{
KickStarter.player.transform.position += movementDirection.normalized * speed * Time.deltaTime;
}
}
}
From what I have right now, the player moves along the path only when it is standing still. I cannot seem to get the variable for the player position that is constantly updating(?). Any suggestions on how to go about this?
Thank you.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @blob1.
The exact way AC handles its character motion is down to your Player settings and attached components - could you share screenshots to show their setup?
Generally though, you can try moving them in LateUpdate - using the Trigger functions to keep track of the Player's presence. Try this:
Thank you for the solution. This works perfectly