cocos creator 刚体

2018-10-19  本文已影响515人  cmd_ts
//开启刚体
cc.director.getPhysicsManager().enabled = true;

//改变刚体大小,改变其父节点即可
this.node.scale = 0.5;

//获取刚体的速度
this.rigidbody = this.node.getComponent(cc.RigidBody);
var velocity = this.rigidbody.linearVelocity;

//设置刚体的速度
this.rigidbody = this.node.getComponent(cc.RigidBody);
this.rigidbody.linearVelocity = cc.v2(0,0);
上一篇 下一篇

猜你喜欢

热点阅读