2021
07-22
07-22
Unity实现桌面反弹的示例代码
一:演示视频二:代码实现usingUnityEngine;publicclassBall:MonoBehaviour{privateRigidbodyrigid;privateVector3lastDir;publicfloatspeed=30;privatevoidAwake(){rigid=GetComponent<Rigidbody>();rigid.velocity=newVector3(1,0,1)*speed;}privatevoidLateUpdate(){lastDir=rigid.velocity;}privatevoidOnCollisionEnt...
继续阅读 >