Hello, I tried everything to synchronize the ball and the camera. Because using the Unity official Rollerball script the ball moves in the same axis so the the ball don’t match the camera. Please help with that!
Thanks!
Hello, I tried everything to synchronize the ball and the camera. Because using the Unity official Rollerball script the ball moves in the same axis so the the ball don’t match the camera. Please help with that!
Thanks!
You clearly didn’t try everything because everything includes a solution that works.
Instead of moving the ball based on the absolute world axis (Vector3.up, for example), move the ball based on the camera axis (camera.transform.forward, for example).
how could I combine these and the official script to make the ball still roll instead of just moving and I’m in 8th grade (just additional info)
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
}