当前位置: 首页 > news >正文

安陆网站的建设上海网站建设q.479185700棒

安陆网站的建设,上海网站建设q.479185700棒,优化的意思,长春网站开发培训碰撞检测文档 刚体自行选择#xff0c;刚体正常设置分组、tag#xff0c;tag用于区分是哪个物体被碰撞了 正常在一个node下挂载脚本就行 注意#xff1a;Builtin 2D 物理模块只会发送 BEGIN_CONTACT 和 END_CONTACT 回调消息。ccclass(TestContactCallBack) export class …碰撞检测文档 刚体自行选择刚体正常设置分组、tagtag用于区分是哪个物体被碰撞了 正常在一个node下挂载脚本就行 注意Builtin 2D 物理模块只会发送 BEGIN_CONTACT 和 END_CONTACT 回调消息。ccclass(TestContactCallBack) export class TestContactCallBack extends Component {start () {// 注册单个碰撞体的回调函数let collider this.getComponent(Collider2D);if (collider) {collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);}// 注册全局碰撞回调函数if (PhysicsSystem2D.instance) {PhysicsSystem2D.instance.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);PhysicsSystem2D.instance.on(Contact2DType.END_CONTACT, this.onEndContact, this);PhysicsSystem2D.instance.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);PhysicsSystem2D.instance.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);}}onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {// 只在两个碰撞体开始接触时被调用一次console.log(onBeginContact);} 1、需要注意的是 刚体不能两个都是static否则不会触发碰撞回调 2、碰撞回调的时候不能直接进行node销毁否则会奔溃 onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {// 只在两个碰撞体开始接触时被调用一次console.log(onBeginContact222otherCollider.name);console.log(onBeginContact222name:selfCollider.name);// console.log(onBeginContact222tag:selfCollider.tag);if(selfCollider.tag10 otherCollider.tag20){setTimeout(() {if(this.node this.node.isValid) {selfCollider.node.destroy();otherCollider.node.destroy();}}, 500);}
http://www.zqtcl.cn/news/170732/

相关文章:

  • 有没有专门做衣服的网站小程序加盟代理前景
  • app网站开发报价wordpress怎么加快网站打开速度
  • 路南网站建设可用的ftp网站
  • 台州市建站公司网站免费建设推荐
  • 网站世界排名怎么做柘城县网站建设
  • 网站设计与制作培训班户外运动网站建设策划
  • 保险公司网站网站域名注册哪个好
  • 平台网站建设可行报告工作室注册条件
  • 罗湖附近公司做网站建设哪家便宜做cpa必须要有网站吗
  • 深圳网站开发教程wordpress密码登录插件
  • 农机网站建设目标上海网站建设工资多少
  • 手机做网站过程网站名字做版权需要源代码吗
  • 公司微信网站建设方案现在做外贸前景如何
  • 如何使用微信公众号做网站河南省专业做网站公司
  • 清远市清城区网站建设公司广州黄浦区建设局网站
  • 站长做2个网站网站程序指的是什么
  • 网站建设jw100请拿笔记记下新域名
  • 兰州市住房保障和城乡建设局网站如何有效的推广网站
  • 网站推广做百度还是360北京企业网站建设费用
  • 推荐一个简单的网站制作策划方案免费网站
  • 用vs2012做网站案例企业现在有必要做网站吗
  • 网站建设少用控件wordpress默认分类
  • php网站是什么数据库文件网站开发收
  • 新网网站空间做网站和app哪类商标
  • drupal网站建设数据库厦门市网站建设
  • 解释微信微网站室内设计效果图展板
  • 教做发绳的网站游戏网站建设需要多少钱
  • 那个网站可以做双色球号码对比的网站设计好学吗
  • 网站建设如何获取客户韩国建筑网站
  • 固始网站建设公司wordpress会员功能