开始刚体速度是0,操作之后我想给刚体一个速度
start () {
this.rigidBody = this.node.getComponent(cc.RigidBody);
},
setVelocity(vx,vy){ //设置瞄准线速度vx,vy
self = this;
self.rigidBody.linearVelocity =cc.v2(400,250);
}
出现错误提示
ERROR: Uncaught TypeError: Cannot set property ‘linearVelocity’ of undefined,请问怎么办