Add Unity3D projects

This commit is contained in:
2024-03-09 19:25:59 +00:00
parent 1c71f24fab
commit 829289c881
4626 changed files with 441247 additions and 0 deletions

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// script to summon the camera to the player car
public class SummonCamera : MonoBehaviour
{
public Vector3 offset = new Vector3(0f, 4f, -10f);
public float speed = 10f; // speed of camera movement
public Camera mc;
void Start() {
mc = Camera.main;
}
private void FixedUpdate()
{
mc.transform.position = Vector3.Lerp(mc.transform.position, transform.TransformPoint(offset), speed * Time.deltaTime);
mc.transform.rotation = Quaternion.Lerp(mc.transform.rotation, Quaternion.LookRotation(transform.position - mc.transform.position, Vector3.up), speed * Time.deltaTime);
}
}