下边附上摄像机跟随人物移动,点击人物之后触发事件的Demo
下边附加上Ts的CameraFollow脚本
export default class CameraFollow extends Laya.Script {
private CameraGameObj:Laya.Sprite3D;
private target:Laya.Sprite3D;
public angle:number=30;
public distance:number=25;
public dis:Laya.Vector3=new Laya.Vector3();
private point:Laya.Vector2=new Laya.Vector2();
private camera:Laya.Camera;
private scene:Laya.Scene3D;
private ray:Laya.Ray;
private outHitResult:Laya.HitResult;
constructor() {
super();
<