-
4.陷阱二
public speed;
void onTriggerEnter(collider other)//other指碰撞过来的物体
{
other=GameObject.GetComponent<Rigidbody>();
other.AddForce(vector3.up*speed,ForceMode.Impulse);
}
查看全部 -
Is Kinematic 如果勾选了就是绝对静止
Interpolate 差值, 使得物体的移动更加的自然,但是弊端就是可能与物体的渲染不同步,则会看到抖动
查看全部 -
5.陷阱三
private Rigidbody m_cycle;
void Start(){
m_cycle=this.GetComponent<Rigidbody>();}
void FixdeUpdate(){
m_cycle.angularVelocity=vector3.up*speed;}
查看全部 -
111111
查看全部 -
1111111111
查看全部 -
特别好哈哈哈哈
查看全部 -
OnCollisionEnter
查看全部 -
小球装入大炮 OnTriggerEnter
查看全部 -
MovePosition
查看全部 -
获取该obj的this.transform, this.GetCompoent<Rigidbody>();
查看全部 -
刹车处理
rigid.velocity = Vector3.Lerp(rigid.velocity, new Vector3 (0, rigid.velocity.y, 0) , 0,2f);
查看全部 -
private bool brake
brake = Input.GetKey(KeyCode.Space);
按下空格 刹车
查看全部 -
update 里面接受键盘wsad的input
dir = Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
查看全部 -
5.平台移动MovePositon();方法
private Transform m_Plate;
private Rigidbody m_plate;
private int direction=1;
public float speed=1;
void Start(){
m_Plate=this.transform;m_plate=GetComponent<Rigidbody>();
}
void Update(){
if(m_Plate.position.x>=5&&direction>0){
direction=-1;else if(m_Plate.position.x<=-6&&directon<0){
direction=1;}
void FixedUpdate(){
m_Plate.MovePositon(vector3.x*speed*direction*Time.Fixeddatetime);查看全部 -
3.陷阱一
public Rigidbody[] m_Rigidbody;
public float speed;
public Rigidbody m_Plate;
public Rigibody m_plate;
private bool isFinish;
private bool VelocityEnough(){
for(int i=0;i<m_Rigidbody.length;i++){
if(m_Rigidbody[i].angularvelocity.y>5){
return=true;
}
else{
return=false;
}
}}
void Update(){
if(VelocityEnough&&!isFinish){
isFinish=false;
for(int i=0; i<m_Rigidbody.length;i++){
m_Rigidbody[i].gameObject.SetActive(false);}
m_Plate.inkincit=false;
else if(isFinish){
m_Plate.velocity=vector3.up*speed;
m_plate.gameobject.SetActive(true):
}
查看全部
举报