using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Transform target;
public float smoothTime = 0.3F;
private float yVelocity = 1.0F;
void Update() {
float newPosition = Mathf.SmoothDamp(transform.position.z, target.position.z-5, ref yVelocity, smoothTime);
transform.position = new Vector3(transform.position.x, transform.position.y,newPosition);
}
}
using System.Collections;
public class example : MonoBehaviour {
public Transform target;
public float smoothTime = 0.3F;
private float yVelocity = 1.0F;
void Update() {
float newPosition = Mathf.SmoothDamp(transform.position.z, target.position.z-5, ref yVelocity, smoothTime);
transform.position = new Vector3(transform.position.x, transform.position.y,newPosition);
}
}
本文将为您介绍如何使用Unity3D进行游戏开发,从基础知识到高级技巧,涵盖游戏引擎的使用、场景搭建、物体创建、动画制作、脚本编写等核心内容。
6580

被折叠的 条评论
为什么被折叠?



