美文网首页
cocos creator 刚体

cocos creator 刚体

作者: cmd_ts | 来源:发表于2018-10-19 11:20 被阅读515次
    //开启刚体
    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);
    

    相关文章

      网友评论

          本文标题:cocos creator 刚体

          本文链接:https://www.haomeiwen.com/subject/nzryzftx.html