Cocos Creator 3D开发入门----CocosCreator3D篮球.zip

所需积分/C币:37 2019-12-13 09:45:49 1.06MB ZIP
124
收藏 收藏
举报

Cocos Creator 3D开发入门----CocosCreator3D篮球.zip import { _decorator, Component, Node, RigidBodyComponent, PhysicMaterial, ColliderComponent } from "cc"; const { ccclass, property } = _decorator; @ccclass("PhyMat") export class PhyMat extends Component { @property private friction: number = 0; // 摩擦力 @property private restitution: number = 0; // 弹力 /* class member could be defined like this */ // dummy = ''; /* use `property` decorator if your want the member to be serializable */ // @property // serializableDummy = 0; onLoad(): void{ let comps: Array = this.node.getComponents(ColliderComponent) as Array; let mat = new PhysicMaterial(); mat.friction = this.friction; mat.restitution = this.restitution; for(let i = 0; i < comps.length; i++){ comps[i].material = mat; } } start () { // Your initialization goes here. } // update (deltaTime: number) { // // Your update function goes here. // } }

...展开详情
立即下载 低至0.43元/次 身份认证VIP会员低至7折
一个资源只可评论一次,评论内容不能少于5个字
您会向同学/朋友/同事推荐我们的CSDN下载吗?
谢谢参与!您的真实评价是我们改进的动力~
  • 签到新秀

关注 私信
上传资源赚钱or赚积分
最新推荐
Cocos Creator 3D开发入门----CocosCreator3D篮球.zip 37积分/C币 立即下载
1/0