- Home /
Question by
ramondotcom8 · Nov 18, 2021 at 04:39 PM ·
playervehicleenter-car
How to enter vehicle using box colliders/collision script,How to enter and exit vehicle/ object using box collider
I was wondering if there was a way to use box colliders or collision script to enter vehicles/GameObjects
public class PlayerControl : MonoBehaviour
{
public float speed = 20.0f;
public float turnSpeed = 45.0f;
private float horizontalInput;
private float fowardInput;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
horizontalInput = Input.GetAxis("Horizontal");
fowardInput = Input.GetAxis("Vertical");
transform.Translate(Vector3.forward * Time.deltaTime * speed * fowardInput);
transform.Rotate(Vector3.up, turnSpeed * horizontalInput * Time.deltaTime);
}
}
Comment
Your answer
Follow this Question
Related Questions
Entering and Leavinging a Car/Tank/... in an FPS 3 Answers
Can't get transform of parent! 1 Answer
Parenting player to car on click. 1 Answer
Enter Vehicle Script not working! 1 Answer
Player in/out of vehicle script 0 Answers