diff --git a/tools/flashfin-rapier2d/.creator/asset-template/typescript/Custom Script Template Help Documentation.url b/tools/flashfin-rapier2d/.creator/asset-template/typescript/Custom Script Template Help Documentation.url new file mode 100644 index 0000000..7606df0 --- /dev/null +++ b/tools/flashfin-rapier2d/.creator/asset-template/typescript/Custom Script Template Help Documentation.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://docs.cocos.com/creator/manual/en/scripting/setup.html#custom-script-template \ No newline at end of file diff --git a/tools/flashfin-rapier2d/.creator/default-meta.json b/tools/flashfin-rapier2d/.creator/default-meta.json new file mode 100644 index 0000000..8ad938f --- /dev/null +++ b/tools/flashfin-rapier2d/.creator/default-meta.json @@ -0,0 +1 @@ +{"trimType":"none","image":{"type":"sprite-frame"},"sprite-frame":{"trimType":"none"}} diff --git a/tools/flashfin-rapier2d/.gitignore b/tools/flashfin-rapier2d/.gitignore new file mode 100644 index 0000000..a231b3f --- /dev/null +++ b/tools/flashfin-rapier2d/.gitignore @@ -0,0 +1,24 @@ + +#/////////////////////////// +# Cocos Creator 3D Project +#/////////////////////////// +library/ +temp/ +local/ +build/ +profiles/ +native +#////////////////////////// +# NPM +#////////////////////////// +node_modules/ + +#////////////////////////// +# VSCode +#////////////////////////// +.vscode/ + +#////////////////////////// +# WebStorm +#////////////////////////// +.idea/ \ No newline at end of file diff --git a/tools/flashfin-rapier2d/LICENSE b/tools/flashfin-rapier2d/LICENSE new file mode 100644 index 0000000..0321454 --- /dev/null +++ b/tools/flashfin-rapier2d/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 soida + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/flashfin-rapier2d/README.md b/tools/flashfin-rapier2d/README.md new file mode 100644 index 0000000..268eeb8 --- /dev/null +++ b/tools/flashfin-rapier2d/README.md @@ -0,0 +1,15 @@ +### 这是什么 +> 这是一个简单的在CocosCreater 3.8.x中使用Rapier2d物理引擎的样例 + +### 兼容版本 +` 3.6.x以上上都支持 ,因为是用的wasm库` `"@dimforge/rapier2d-compat": "^0.15.0"` + +### 使用注意 +1. 拉取仓库 +2. 进入根目录后 `npm install` +3. 可以在 `https://soidaken.github.io/flashfin-rapier2d-runpage/` 查看运行效果 + + +### 帮到你了吗? +如果对你有帮助,请不吝赞助我一杯卡布奇诺☕️,谢谢! +![myRewardCode](https://github.com/soidaken/flashfin-tipQRcode/blob/main/reward-qrcode-small.jpg) diff --git a/tools/flashfin-rapier2d/assets/fonts.meta b/tools/flashfin-rapier2d/assets/fonts.meta new file mode 100644 index 0000000..bb2eb4b --- /dev/null +++ b/tools/flashfin-rapier2d/assets/fonts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "6f5a343f-6383-4387-afc0-17b54ab0e2de", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/tools/flashfin-rapier2d/assets/fonts/pixelhanzi.ttf b/tools/flashfin-rapier2d/assets/fonts/pixelhanzi.ttf new file mode 100644 index 0000000..6fab1e5 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/fonts/pixelhanzi.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2b5de87f0a71f54ce8e3038d392505f73ec8982d3183bd72033bb95cb1cc3a3 +size 617952 diff --git a/tools/flashfin-rapier2d/assets/fonts/pixelhanzi.ttf.meta b/tools/flashfin-rapier2d/assets/fonts/pixelhanzi.ttf.meta new file mode 100644 index 0000000..262f22a --- /dev/null +++ b/tools/flashfin-rapier2d/assets/fonts/pixelhanzi.ttf.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.0.1", + "importer": "ttf-font", + "imported": true, + "uuid": "1cfbb169-e553-48b7-8741-55373a87f587", + "files": [ + ".json", + "pixelhanzi.ttf" + ], + "subMetas": {}, + "userData": {} +} diff --git a/tools/flashfin-rapier2d/assets/prefab.meta b/tools/flashfin-rapier2d/assets/prefab.meta new file mode 100644 index 0000000..bc7b6ac --- /dev/null +++ b/tools/flashfin-rapier2d/assets/prefab.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "236b5f6b-6868-436d-87da-90ff4fcd7d95", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/tools/flashfin-rapier2d/assets/prefab/ballitem.prefab b/tools/flashfin-rapier2d/assets/prefab/ballitem.prefab new file mode 100644 index 0000000..b648dbb --- /dev/null +++ b/tools/flashfin-rapier2d/assets/prefab/ballitem.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1deef33692e186f5a34fb1a267870bcc8bffa9ca2ed4d6702bf3adf6dc7c87c3 +size 4096 diff --git a/tools/flashfin-rapier2d/assets/prefab/ballitem.prefab.meta b/tools/flashfin-rapier2d/assets/prefab/ballitem.prefab.meta new file mode 100644 index 0000000..0ecab05 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/prefab/ballitem.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.50", + "importer": "prefab", + "imported": true, + "uuid": "f011b380-7741-4c8d-ae17-76cf8a5fc011", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "ballitem" + } +} diff --git a/tools/flashfin-rapier2d/assets/prefab/testitem.prefab b/tools/flashfin-rapier2d/assets/prefab/testitem.prefab new file mode 100644 index 0000000..e399100 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/prefab/testitem.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af249c0e5a47b4ad8eceadb1d767aebb8728efdd5e6a30e68c557f8927392222 +size 2734 diff --git a/tools/flashfin-rapier2d/assets/prefab/testitem.prefab.meta b/tools/flashfin-rapier2d/assets/prefab/testitem.prefab.meta new file mode 100644 index 0000000..338b0af --- /dev/null +++ b/tools/flashfin-rapier2d/assets/prefab/testitem.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.50", + "importer": "prefab", + "imported": true, + "uuid": "1f217bc3-f4c1-4c97-80cd-f92e92bebb09", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "testitem" + } +} diff --git a/tools/flashfin-rapier2d/assets/scene_box2d.scene b/tools/flashfin-rapier2d/assets/scene_box2d.scene new file mode 100644 index 0000000..007cfb5 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scene_box2d.scene @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2a42cc3e734db4562e13cb1c9579f177fb7315455b43de4bc4a9c9794d7b45c +size 34332 diff --git a/tools/flashfin-rapier2d/assets/scene_box2d.scene.meta b/tools/flashfin-rapier2d/assets/scene_box2d.scene.meta new file mode 100644 index 0000000..66792ed --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scene_box2d.scene.meta @@ -0,0 +1,11 @@ +{ + "ver": "1.1.50", + "importer": "scene", + "imported": true, + "uuid": "452ca018-6ac2-414a-966a-166c7c8f4c30", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": {} +} diff --git a/tools/flashfin-rapier2d/assets/scene_rapier2d.scene b/tools/flashfin-rapier2d/assets/scene_rapier2d.scene new file mode 100644 index 0000000..52fd6cd --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scene_rapier2d.scene @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d95e8639eae7196c39891dafd3b992ceda0da137cb176e04b8ce0deb1624f128 +size 42785 diff --git a/tools/flashfin-rapier2d/assets/scene_rapier2d.scene.meta b/tools/flashfin-rapier2d/assets/scene_rapier2d.scene.meta new file mode 100644 index 0000000..bec77c5 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scene_rapier2d.scene.meta @@ -0,0 +1 @@ +{"ver":"1.1.50","importer":"scene","imported":true,"uuid":"6773b206-616b-4cb6-9a1b-0182367abb1c","files":[".json"],"subMetas":{},"userData":{}} diff --git a/tools/flashfin-rapier2d/assets/scripts.meta b/tools/flashfin-rapier2d/assets/scripts.meta new file mode 100644 index 0000000..20dc990 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scripts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "fe6eee8d-b74e-4f57-be34-fb9bacca7f0f", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/tools/flashfin-rapier2d/assets/scripts/Clogger.ts b/tools/flashfin-rapier2d/assets/scripts/Clogger.ts new file mode 100644 index 0000000..d325d03 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scripts/Clogger.ts @@ -0,0 +1,49 @@ + +function padStart(value: string | number, length: number, padChar: string): string { + let result = String(value); + while (result.length < length) { + result = padChar + result; + } + return result; +} + +class Clogger { + private prefix: string; + + constructor(prefix: string = '') { + this.prefix = prefix; + } + + // 将参数转换为字符串并输出到控制台 + private formatAndLog(...args: any[]): void { + const now = new Date(); + const hours = padStart(now.getHours(), 2, '0'); + const minutes = padStart(now.getMinutes(), 2, '0'); + const seconds = padStart(now.getSeconds(), 2, '0'); + const milliseconds = padStart(now.getMilliseconds(), 3, '0'); + + const timestamp = `${hours}:${minutes}:${seconds}.${milliseconds}`; + + console.log( + this.prefix +'|'+ timestamp +'|'+ + args.map(arg => (typeof arg === 'object' ? JSON.stringify(arg) : String(arg))).join(' ') + ); + } + debug(...args: any[]): void { + this.formatAndLog('DEBUG', ...args); + } + + log(...args: any[]): void { + this.formatAndLog('LOG', ...args); + } + + warn(...args: any[]): void { + this.formatAndLog('WARN', ...args); + } + + error(...args: any[]): void { + this.formatAndLog('ERROR', ...args); + } +} + +export const logger = new Clogger('SOIDA'); \ No newline at end of file diff --git a/tools/flashfin-rapier2d/assets/scripts/Clogger.ts.meta b/tools/flashfin-rapier2d/assets/scripts/Clogger.ts.meta new file mode 100644 index 0000000..852b707 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scripts/Clogger.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "ff0e1b17-5af0-4e18-8357-b98382f3911c", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/tools/flashfin-rapier2d/assets/scripts/RapierDebugRenderer.ts b/tools/flashfin-rapier2d/assets/scripts/RapierDebugRenderer.ts new file mode 100644 index 0000000..dd36973 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scripts/RapierDebugRenderer.ts @@ -0,0 +1,100 @@ +import { _decorator, Component, Graphics, Color } from 'cc'; +const { ccclass, property } = _decorator; + +// import RAPIER from '@dimforge/rapier2d'; + +export const RAPIER_PTM_RATIO:number = 32.0; + +@ccclass('RapierDebugRenderer') +export class RapierDebugRenderer extends Component { + @property(Graphics) + graphics: Graphics = null!; + + // 可选:可调整的线宽 + @property + lineWidth: number = 1.0; + + // 可选:坐标缩放系数 + @property + scale: number = RAPIER_PTM_RATIO; + + @property + onoff: boolean = false; + + + private _world: any = null; // RAPIER.World 类型 + + /** + * 设置物理世界引用 + * @param world RAPIER物理世界实例 + */ + public setWorld(world: any) { + this._world = world; + } + + /** + * 在每帧更新中调用以渲染调试图形 + */ + update() { + if (!this._world || !this.graphics) return; + + this.onoff && this.render(this._world); + } + + clear(){ + this.graphics&&this.graphics.clear(); + } + + /** + * 渲染物理世界的调试信息 + * @param world RAPIER物理世界 + */ + render(world: any) { + // 获取调试渲染数据 + const { vertices, colors } = world.debugRender(); + + // 清除之前的绘制内容 + this.graphics.clear(); + + // const g = this.graphics; + // g.lineWidth = 10; + // g.fillColor.fromHEX('#ff0000ff'); + // g.moveTo(-40, 0); + // g.lineTo(0, -80); + // g.lineTo(40, 0); + // g.lineTo(0, 80); + // g.close(); + // g.stroke(); + // g.fill(); + + // 遍历所有线段进行绘制 + for (let i = 0; i < vertices.length / 4; i++) { + // 从颜色数组中获取当前线段的颜色 + const r = Math.floor(colors[i * 8] * 255); // 转换为 0-255 范围 + const g = Math.floor(colors[i * 8 + 1] * 255); + const b = Math.floor(colors[i * 8 + 2] * 255); + const a = colors[i * 8 + 3] * 255; // alpha 直接使用 0-255 范围 + + // 设置线条样式 + this.graphics.lineWidth = this.lineWidth; + this.graphics.strokeColor = new Color(r, g, b, a); + + // 获取线段的起点和终点坐标 + // 注意:Cocos Creator 使用左下角为原点的坐标系,y轴向上为正 + // 而 RAPIER 可能使用不同的坐标系,因此这里做适当调整 + + // 获取原始坐标 + let x1 = vertices[i * 4] * this.scale; + let y1 = vertices[i * 4 + 1] * this.scale; + let x2 = vertices[i * 4 + 2] * this.scale; + let y2 = vertices[i * 4 + 3] * this.scale; + + + // 执行绘制 + this.graphics.moveTo(x1, y1); + this.graphics.lineTo(x2, y2); + this.graphics.close(); + this.graphics.stroke(); + } + } +} \ No newline at end of file diff --git a/tools/flashfin-rapier2d/assets/scripts/RapierDebugRenderer.ts.meta b/tools/flashfin-rapier2d/assets/scripts/RapierDebugRenderer.ts.meta new file mode 100644 index 0000000..4e5ab15 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scripts/RapierDebugRenderer.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "020358be-0b18-47a4-ad46-a6972ff0ed99", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/tools/flashfin-rapier2d/assets/scripts/SceneMain.ts b/tools/flashfin-rapier2d/assets/scripts/SceneMain.ts new file mode 100644 index 0000000..3074cce --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scripts/SceneMain.ts @@ -0,0 +1,87 @@ +import { _decorator, Color, Component, instantiate, Label, Node, Prefab, Sprite } from 'cc'; +import * as cc from 'cc'; + +import { logger } from './Clogger'; +const { ccclass, property } = _decorator; + +@ccclass('SceneMain') +export class SceneMain extends Component { + + @property(Node) + node_fps:Node|null = null; + + @property(Node) + node_counts:Node|null = null; + + @property(Prefab) + prefab_item:Prefab|null = null; + + @property(Node) + container_balls:Node|null = null; + + @property(cc.Node) + node_switchscene:cc.Node|null = null; + + private _timeAccumulator: any; + private _countAcc: any; + + private _listBalls: Node[] = []; + + protected onLoad(): void { + logger.log('dballs onLoad'); + + let p = cc.PhysicsSystem2D.instance; + p.positionIterations = 4; + p.velocityIterations = 2; + + } + start() { + logger.log('dballs start'); + + // let n= this.node.getChildByName('ballitem') + // let r = n.getComponent(cc.CircleCollider2D).radius + // logger.log('radius:', r); + + this.node_switchscene.on('click', (b:cc.Button) => { + cc.director.loadScene('scene_rapier2d'); + }); + } + + update(dt: number) { + if (!this._timeAccumulator) { + this._timeAccumulator = 0; + } + this._timeAccumulator += dt; + + if (this._timeAccumulator >= 0.1) { + this.node_fps.getComponent(Label)!.string = `FPS: ${Math.floor(1 / dt)}`; + this._timeAccumulator = 0; + } + + if(Math.floor(1 / dt) < 30){ + return; + } + + if (!this._countAcc) { + this._countAcc = 0; + } + // this._countAcc += 1; + //每秒实例化添加5个node_item 到场景中,并且显示当前场景中的node_item数量 + // if (this._countAcc >= 60/60) { + for (let i = 0; i < 4; i++) { + let node = instantiate(this.prefab_item); + node.getComponent(Sprite).color = new Color(Math.random()*255, Math.random()*255, Math.random()*255); + this.container_balls.addChild(node); + let x = (Math.random()*2-1)*cc.view.getVisibleSize().width/2;; + node.setPosition(x, 400); + this._listBalls.push(node); + } + this.node_counts.getComponent(Label)!.string = `BALLS: ${this._listBalls.length}`; + this._countAcc = 0; + // } + + + } +} + + diff --git a/tools/flashfin-rapier2d/assets/scripts/SceneMain.ts.meta b/tools/flashfin-rapier2d/assets/scripts/SceneMain.ts.meta new file mode 100644 index 0000000..fa918c1 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scripts/SceneMain.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "22878c0e-0345-4a10-896a-6c1520d22df5", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/tools/flashfin-rapier2d/assets/scripts/SceneRapier2d.ts b/tools/flashfin-rapier2d/assets/scripts/SceneRapier2d.ts new file mode 100644 index 0000000..c026f37 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scripts/SceneRapier2d.ts @@ -0,0 +1,180 @@ +import { _decorator, Color, Component, instantiate, Label, Node, Prefab, Sprite } from 'cc'; +import * as cc from 'cc'; + +import RAPIER, { IntegrationParameters } from '@dimforge/rapier2d-compat'; +import { RAPIER_PTM_RATIO, RapierDebugRenderer } from './RapierDebugRenderer'; +import { logger } from './Clogger'; + +const { ccclass, property } = _decorator; + +@ccclass('SceneRapier2d') +export class SceneRapier2d extends Component { + + @property(Node) + node_fps:Node|null = null; + + @property(Node) + node_counts:Node|null = null; + + @property(Prefab) + prefab_item:Prefab|null = null; + + @property(Node) + container_balls:Node|null = null; + + @property(cc.Node) + node_switch:cc.Node|null = null; + + @property(cc.Node) + node_switchscene:cc.Node|null = null; + + + private _timeAccumulator: any; + private _countAcc: any; + + + private world: RAPIER.World; + private gravity = new RAPIER.Vector2(0, -10); + private _initComplete: boolean = false; + private _rigidBody: RAPIER.RigidBody; + private _debugRenderer: RapierDebugRenderer; + + + //将一个node和一个RigidBody绑定 + private _mapNodeBalls: Map = new Map(); + + + protected async onLoad(): Promise { + logger.log('dballs onLoad'); + + RAPIER.init().then(() => { + logger.log('RAPIER.init success'); + this._initComplete = true; + // 创建物理世界 + this.world = new RAPIER.World(this.gravity); + this.fillWorld(); + this._debugRenderer = this.getComponent(RapierDebugRenderer)!; + this._debugRenderer.setWorld(this.world); + + this.afterInit(); + }); + + } + + afterInit() { + + this.node_switch.children[0]!.getComponent(Label).string = this._debugRenderer.onoff ? 'debug:ON' : 'debug:OFF'; + this.node_switch.on('click', (b:cc.Button) => { + this._debugRenderer.onoff = !this._debugRenderer.onoff; + this._debugRenderer.clear(); + b!.node.children[0]!.getComponent(Label).string = this._debugRenderer.onoff ? 'debug:ON' : 'debug:OFF'; + }); + + } + + start() { + logger.log('dballs start'); + + + + this.node_switchscene.on('click', (b:cc.Button) => { + cc.director.loadScene('scene_box2d'); + }); + + // this.schedule((dt:number)=>{ + // if(!this._initComplete){ + // return; + // } + + // this.world.step(); + + // this._mapNodeBalls.forEach((rigidBody, node)=>{ + // let position = rigidBody.translation(); + // node.setPosition(position.x*RAPIER_PTM_RATIO, position.y*RAPIER_PTM_RATIO); + // node.active = true; + // }); + + + // }, 1/60, cc.macro.REPEAT_FOREVER, 0); + + } + + + fillWorld(){ + let world = this.world; + let viewSize = cc.view.getVisibleSize(); + let groundRigidBody = world.createRigidBody(new RAPIER.RigidBodyDesc(RAPIER.RigidBodyType.Fixed)); + world.createCollider(RAPIER.ColliderDesc.cuboid(viewSize.width/2, 0.5).setTranslation(0,-viewSize.height/(2*RAPIER_PTM_RATIO)).setRestitution(1).setFriction(0.0), groundRigidBody); + + let groundRigidBody1 = world.createRigidBody(new RAPIER.RigidBodyDesc(RAPIER.RigidBodyType.Fixed)); + world.createCollider(RAPIER.ColliderDesc.cuboid(0.5,viewSize.height/2 ).setTranslation(-viewSize.width/(2*RAPIER_PTM_RATIO),0).setRestitution(1).setFriction(0.0), groundRigidBody1); + + let groundRigidBody2 = world.createRigidBody(new RAPIER.RigidBodyDesc(RAPIER.RigidBodyType.Fixed)); + world.createCollider(RAPIER.ColliderDesc.cuboid(0.5,viewSize.height/2 ).setTranslation(viewSize.width/(2*RAPIER_PTM_RATIO),0).setRestitution(1).setFriction(0.0), groundRigidBody2); + + // let rigidBody = world.createRigidBody(new RAPIER.RigidBodyDesc(RAPIER.RigidBodyType.Dynamic).setTranslation(0.0, 5.0).setLinearDamping(0).setAngularDamping(0)); + // let collider = world.createCollider(RAPIER.ColliderDesc.ball(0.5).setDensity(1.0).setRestitution(1).setFriction(0.0), rigidBody); + // this._rigidBody = rigidBody; + } + + + + + update(dt: number) { + if (!this._timeAccumulator) { + this._timeAccumulator = 0; + } + this._timeAccumulator += dt; + + // if (this._timeAccumulator >= 0.1) { + this.node_fps.getComponent(Label)!.string = `FPS: ${Math.floor(1 / dt)}`; + // this._timeAccumulator = 0; + // } + + if(Math.floor(1 / dt) < 30){ + return; + } + + if (!this._countAcc) { + this._countAcc = 0; + } + + //物理系统同步 + if(!this._initComplete){ + return; + } + this.world.step(); + this._mapNodeBalls.forEach((rigidBody, node)=>{ + let position = rigidBody.translation(); + node.setPosition(position.x*RAPIER_PTM_RATIO, position.y*RAPIER_PTM_RATIO); + node.active = true; + }); + + + // this._countAcc += 1; + // if (this._countAcc >= 60/60) { + for (let i = 0; i < 4; i++) { + let node = instantiate(this.prefab_item); + node.getComponent(Sprite).color = new Color(Math.random()*255, Math.random()*255, Math.random()*255); + node.active = false; + this.container_balls.addChild(node); + let x = (Math.random()*2-1)*cc.view.getVisibleSize().width/2; + let y = 400; + + let r = (node.getComponent(cc.UITransform).width-2)/2 ; + let rigidBody = this.world.createRigidBody(new RAPIER.RigidBodyDesc(RAPIER.RigidBodyType.Dynamic).setTranslation(x/RAPIER_PTM_RATIO, y/RAPIER_PTM_RATIO).setLinearDamping(0).setAngularDamping(0).setCanSleep(false)); + this.world.createCollider(RAPIER.ColliderDesc.ball(r/RAPIER_PTM_RATIO).setDensity(1.0).setRestitution(0.5).setFriction(0.0), rigidBody); + this._mapNodeBalls.set(node, rigidBody); + // node.setPosition(x, 400); + // this._listBalls.push(node); + + } + this.node_counts.getComponent(Label)!.string = `BALLS: ${this.container_balls.children.length}`; + // this._countAcc = 0; + // } + + + } +} + + diff --git a/tools/flashfin-rapier2d/assets/scripts/SceneRapier2d.ts.meta b/tools/flashfin-rapier2d/assets/scripts/SceneRapier2d.ts.meta new file mode 100644 index 0000000..9a0801b --- /dev/null +++ b/tools/flashfin-rapier2d/assets/scripts/SceneRapier2d.ts.meta @@ -0,0 +1 @@ +{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"188ce8c7-8772-4533-8d62-ad630ea294eb","files":[],"subMetas":{},"userData":{}} diff --git a/tools/flashfin-rapier2d/assets/textures.meta b/tools/flashfin-rapier2d/assets/textures.meta new file mode 100644 index 0000000..af37641 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/textures.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "01530936-dd18-4bfd-8c4b-7cb2ce4e87ed", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/tools/flashfin-rapier2d/assets/textures/ball1.png b/tools/flashfin-rapier2d/assets/textures/ball1.png new file mode 100644 index 0000000..6d5a962 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/textures/ball1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a02d41a15d1c38ead4f3325f9f29d7c4a96bda540a8cab1626e58c6e844c2f8f +size 1509 diff --git a/tools/flashfin-rapier2d/assets/textures/ball1.png.meta b/tools/flashfin-rapier2d/assets/textures/ball1.png.meta new file mode 100644 index 0000000..5c9c3f2 --- /dev/null +++ b/tools/flashfin-rapier2d/assets/textures/ball1.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.27", + "importer": "image", + "imported": true, + "uuid": "cd9e5dce-f1bc-4320-acc4-4acd8bb105e7", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "cd9e5dce-f1bc-4320-acc4-4acd8bb105e7@6c48a", + "displayName": "ball1", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0, + "isUuid": true, + "imageUuidOrDatabaseUri": "cd9e5dce-f1bc-4320-acc4-4acd8bb105e7", + "visible": false + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "cd9e5dce-f1bc-4320-acc4-4acd8bb105e7@f9941", + "displayName": "ball1", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 70, + "height": 70, + "rawWidth": 70, + "rawHeight": 70, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -35, + -35, + 0, + 35, + -35, + 0, + -35, + 35, + 0, + 35, + 35, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 70, + 70, + 70, + 0, + 0, + 70, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -35, + -35, + 0 + ], + "maxPos": [ + 35, + 35, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "cd9e5dce-f1bc-4320-acc4-4acd8bb105e7@6c48a", + "atlasUuid": "", + "trimType": "none" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "hasAlpha": true, + "fixAlphaTransparencyArtifacts": false, + "redirect": "cd9e5dce-f1bc-4320-acc4-4acd8bb105e7@6c48a" + } +} diff --git a/tools/flashfin-rapier2d/engine-mangle-config.json b/tools/flashfin-rapier2d/engine-mangle-config.json new file mode 100644 index 0000000..822434f --- /dev/null +++ b/tools/flashfin-rapier2d/engine-mangle-config.json @@ -0,0 +1,132 @@ +{ + "__doc_url__": "https://docs.cocos.com/creator/3.8/manual/zh/advanced-topics/mangle-properties.html", + "COMMON": { + "mangleProtected": false, + "mangleList": [ + "UITransform._sortSiblings", + "UITransform._cleanChangeMap", + "Node._findComponents", + "Node._findChildComponent", + "Node._findChildComponents", + "Node.idGenerator", + "Node._stacks", + "Node._stackId", + "Node._setScene", + "EffectAsset._layoutValid", + "EffectAsset._effects", + "ReflectionProbe.DEFAULT_CUBE_SIZE", + "ReflectionProbe.DEFAULT_PLANER_SIZE", + "WebGLDeviceManager.setInstance", + "WebGL2DeviceManager.setInstance", + "CanvasPool" + ], + "dontMangleList": [ + "Component" + ] + }, + "HTML5": { + "extends": "COMMON", + "mangleList": [], + "dontMangleList": [] + }, + "NATIVE": { + "extends": "COMMON", + "mangleList": [], + "dontMangleList": [] + }, + "MINIGAME": { + "extends": "COMMON", + "mangleList": [], + "dontMangleList": [] + }, + "WECHAT": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "BYTEDANCE": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "XIAOMI": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "ALIPAY": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "TAOBAO_MINIGAME": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "OPPO": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "VIVO": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "HUAWEI": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "MIGU": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "HONOR": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "COCOS_RUNTIME": { + "extends": "MINIGAME", + "mangleList": [], + "dontMangleList": [] + }, + "ANDROID": { + "extends": "NATIVE", + "mangleList": [], + "dontMangleList": [] + }, + "WINDOWS": { + "extends": "NATIVE", + "mangleList": [], + "dontMangleList": [] + }, + "IOS": { + "extends": "NATIVE", + "mangleList": [], + "dontMangleList": [] + }, + "MAC": { + "extends": "NATIVE", + "mangleList": [], + "dontMangleList": [] + }, + "OHOS": { + "extends": "NATIVE", + "mangleList": [], + "dontMangleList": [] + }, + "OPEN_HARMONY": { + "extends": "NATIVE", + "mangleList": [], + "dontMangleList": [] + }, + "LINUX": { + "extends": "NATIVE", + "mangleList": [], + "dontMangleList": [] + } +} diff --git a/tools/flashfin-rapier2d/package-lock.json b/tools/flashfin-rapier2d/package-lock.json new file mode 100644 index 0000000..f9a6f20 --- /dev/null +++ b/tools/flashfin-rapier2d/package-lock.json @@ -0,0 +1,19 @@ +{ + "name": "phy2d-test", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "phy2d-test", + "dependencies": { + "@dimforge/rapier2d-compat": "^0.15.0" + } + }, + "node_modules/@dimforge/rapier2d-compat": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@dimforge/rapier2d-compat/-/rapier2d-compat-0.15.0.tgz", + "integrity": "sha512-Jj3bSd225iKSLaZTd6Kh3nrA8X9Zj5FcfAVKYN1xizt8PPwHaGK2gY46arTQo7CmSqONfYvI+G8fPY6xP7SeiQ==", + "license": "Apache-2.0" + } + } +} diff --git a/tools/flashfin-rapier2d/package.json b/tools/flashfin-rapier2d/package.json new file mode 100644 index 0000000..c5ec0bc --- /dev/null +++ b/tools/flashfin-rapier2d/package.json @@ -0,0 +1,10 @@ +{ + "name": "phy2d-test", + "uuid": "49871c9c-fccf-4e92-8887-3966b708b800", + "creator": { + "version": "3.8.7" + }, + "dependencies": { + "@dimforge/rapier2d-compat": "^0.15.0" + } +} diff --git a/tools/flashfin-rapier2d/settings/v2/packages/builder.json b/tools/flashfin-rapier2d/settings/v2/packages/builder.json new file mode 100644 index 0000000..7526e40 --- /dev/null +++ b/tools/flashfin-rapier2d/settings/v2/packages/builder.json @@ -0,0 +1,3 @@ +{ + "__version__": "1.3.9" +} diff --git a/tools/flashfin-rapier2d/settings/v2/packages/cocos-service.json b/tools/flashfin-rapier2d/settings/v2/packages/cocos-service.json new file mode 100644 index 0000000..695ee1c --- /dev/null +++ b/tools/flashfin-rapier2d/settings/v2/packages/cocos-service.json @@ -0,0 +1,23 @@ +{ + "__version__": "3.0.9", + "game": { + "name": "未知游戏", + "app_id": "UNKNOW", + "c_id": "0" + }, + "appConfigMaps": [ + { + "app_id": "UNKNOW", + "config_id": "6c525d" + } + ], + "configs": [ + { + "app_id": "UNKNOW", + "config_id": "6c525d", + "config_name": "Default", + "config_remarks": "", + "services": [] + } + ] +} diff --git a/tools/flashfin-rapier2d/settings/v2/packages/device.json b/tools/flashfin-rapier2d/settings/v2/packages/device.json new file mode 100644 index 0000000..70e599e --- /dev/null +++ b/tools/flashfin-rapier2d/settings/v2/packages/device.json @@ -0,0 +1,3 @@ +{ + "__version__": "1.0.1" +} diff --git a/tools/flashfin-rapier2d/settings/v2/packages/engine.json b/tools/flashfin-rapier2d/settings/v2/packages/engine.json new file mode 100644 index 0000000..ef7d74c --- /dev/null +++ b/tools/flashfin-rapier2d/settings/v2/packages/engine.json @@ -0,0 +1,1108 @@ +{ + "__version__": "1.0.12", + "modules": { + "configs": { + "defaultConfig": { + "name": "Default Config", + "cache": { + "base": { + "_value": true + }, + "gfx-webgl": { + "_value": true + }, + "gfx-webgl2": { + "_value": true + }, + "gfx-webgpu": { + "_value": false + }, + "animation": { + "_value": true + }, + "skeletal-animation": { + "_value": false + }, + "3d": { + "_value": false + }, + "meshopt": { + "_value": false + }, + "2d": { + "_value": true + }, + "sorting-2d": { + "_value": false + }, + "rich-text": { + "_value": true + }, + "mask": { + "_value": true + }, + "graphics": { + "_value": true + }, + "ui-skew": { + "_value": false + }, + "affine-transform": { + "_value": true + }, + "ui": { + "_value": true + }, + "particle": { + "_value": false + }, + "physics": { + "_value": false, + "_option": "physics-ammo" + }, + "physics-ammo": { + "_value": false, + "_flags": { + "LOAD_BULLET_MANUALLY": false + } + }, + "physics-cannon": { + "_value": false + }, + "physics-physx": { + "_value": false, + "_flags": { + "LOAD_PHYSX_MANUALLY": false + } + }, + "physics-builtin": { + "_value": false + }, + "physics-2d": { + "_value": true, + "_option": "physics-2d-box2d-wasm" + }, + "physics-2d-box2d": { + "_value": false + }, + "physics-2d-box2d-wasm": { + "_value": false, + "_flags": { + "LOAD_BOX2D_MANUALLY": false + } + }, + "physics-2d-builtin": { + "_value": false + }, + "physics-2d-box2d-jsb": { + "_value": false + }, + "intersection-2d": { + "_value": true + }, + "primitive": { + "_value": false + }, + "profiler": { + "_value": true + }, + "occlusion-query": { + "_value": false + }, + "geometry-renderer": { + "_value": false + }, + "debug-renderer": { + "_value": false + }, + "particle-2d": { + "_value": true + }, + "audio": { + "_value": true + }, + "video": { + "_value": true + }, + "webview": { + "_value": true + }, + "tween": { + "_value": true + }, + "websocket": { + "_value": false + }, + "websocket-server": { + "_value": false + }, + "terrain": { + "_value": false + }, + "light-probe": { + "_value": false + }, + "tiled-map": { + "_value": true + }, + "vendor-google": { + "_value": false + }, + "spine": { + "_value": true, + "_option": "spine-3.8" + }, + "spine-3.8": { + "_value": true, + "_flags": { + "LOAD_SPINE_MANUALLY": false + } + }, + "spine-4.2": { + "_value": false, + "_flags": { + "LOAD_SPINE_MANUALLY": false + } + }, + "dragon-bones": { + "_value": true + }, + "marionette": { + "_value": true + }, + "procedural-animation": { + "_value": true + }, + "custom-pipeline-post-process": { + "_value": false + }, + "render-pipeline": { + "_value": true, + "_option": "custom-pipeline" + }, + "custom-pipeline": { + "_value": true + }, + "legacy-pipeline": { + "_value": false + }, + "xr": { + "_value": false + } + }, + "flags": { + "LOAD_BOX2D_MANUALLY": false, + "LOAD_SPINE_MANUALLY": false + }, + "includeModules": [ + "2d", + "affine-transform", + "animation", + "audio", + "base", + "custom-pipeline", + "dragon-bones", + "gfx-webgl", + "gfx-webgl2", + "graphics", + "intersection-2d", + "marionette", + "mask", + "particle-2d", + "physics-2d-box2d-wasm", + "procedural-animation", + "profiler", + "rich-text", + "spine-3.8", + "tiled-map", + "tween", + "ui", + "video", + "webview" + ], + "noDeprecatedFeatures": { + "value": false, + "version": "" + } + }, + "custom-config-2acefad2-e474-4267-8422-1688b9165971": { + "name": "box2d-js", + "cache": { + "base": { + "_value": true + }, + "gfx-webgl": { + "_value": true + }, + "gfx-webgl2": { + "_value": false + }, + "gfx-webgpu": { + "_value": false + }, + "animation": { + "_value": true + }, + "skeletal-animation": { + "_value": true + }, + "3d": { + "_value": false + }, + "meshopt": { + "_value": false + }, + "2d": { + "_value": true + }, + "sorting-2d": { + "_value": false + }, + "rich-text": { + "_value": true + }, + "mask": { + "_value": true + }, + "graphics": { + "_value": true + }, + "ui-skew": { + "_value": true + }, + "affine-transform": { + "_value": true + }, + "ui": { + "_value": true + }, + "particle": { + "_value": false + }, + "physics": { + "_value": false, + "_option": "physics-ammo" + }, + "physics-ammo": { + "_value": true, + "_flags": { + "LOAD_BULLET_MANUALLY": false + } + }, + "physics-cannon": { + "_value": false + }, + "physics-physx": { + "_value": false, + "_flags": { + "LOAD_PHYSX_MANUALLY": false + } + }, + "physics-builtin": { + "_value": false + }, + "physics-2d": { + "_value": true, + "_option": "physics-2d-box2d" + }, + "physics-2d-box2d": { + "_value": true + }, + "physics-2d-box2d-wasm": { + "_value": false, + "_flags": { + "LOAD_BOX2D_MANUALLY": false + } + }, + "physics-2d-builtin": { + "_value": false + }, + "physics-2d-box2d-jsb": { + "_value": false + }, + "intersection-2d": { + "_value": true + }, + "primitive": { + "_value": false + }, + "profiler": { + "_value": true + }, + "occlusion-query": { + "_value": false + }, + "geometry-renderer": { + "_value": false + }, + "debug-renderer": { + "_value": false + }, + "particle-2d": { + "_value": true + }, + "audio": { + "_value": true + }, + "video": { + "_value": true + }, + "webview": { + "_value": true + }, + "tween": { + "_value": true + }, + "websocket": { + "_value": true + }, + "websocket-server": { + "_value": false + }, + "terrain": { + "_value": false + }, + "light-probe": { + "_value": false + }, + "tiled-map": { + "_value": true + }, + "vendor-google": { + "_value": false + }, + "spine": { + "_value": true, + "_option": "spine-3.8" + }, + "spine-3.8": { + "_value": true, + "_flags": { + "LOAD_SPINE_MANUALLY": false + } + }, + "spine-4.2": { + "_value": false, + "_flags": { + "LOAD_SPINE_MANUALLY": false + } + }, + "dragon-bones": { + "_value": true + }, + "marionette": { + "_value": true + }, + "procedural-animation": { + "_value": false + }, + "custom-pipeline-post-process": { + "_value": false + }, + "render-pipeline": { + "_value": true, + "_option": "custom-pipeline" + }, + "custom-pipeline": { + "_value": true + }, + "legacy-pipeline": { + "_value": false + }, + "xr": { + "_value": false + } + }, + "flags": { + "LOAD_SPINE_MANUALLY": false + }, + "includeModules": [ + "2d", + "affine-transform", + "animation", + "audio", + "base", + "custom-pipeline", + "dragon-bones", + "gfx-webgl", + "graphics", + "intersection-2d", + "marionette", + "mask", + "particle-2d", + "physics-2d-box2d", + "profiler", + "rich-text", + "skeletal-animation", + "spine-3.8", + "tiled-map", + "tween", + "ui", + "ui-skew", + "video", + "websocket", + "webview" + ], + "noDeprecatedFeatures": { + "value": false, + "version": "" + } + }, + "custom-config-91330ba4-1f85-4d2a-a0d4-55133639da0c": { + "cache": { + "base": { + "_value": true + }, + "gfx-webgl": { + "_value": true + }, + "gfx-webgl2": { + "_value": false + }, + "gfx-webgpu": { + "_value": false + }, + "animation": { + "_value": true + }, + "skeletal-animation": { + "_value": true + }, + "3d": { + "_value": false + }, + "meshopt": { + "_value": false + }, + "2d": { + "_value": true + }, + "sorting-2d": { + "_value": false + }, + "rich-text": { + "_value": true + }, + "mask": { + "_value": true + }, + "graphics": { + "_value": true + }, + "ui-skew": { + "_value": true + }, + "affine-transform": { + "_value": true + }, + "ui": { + "_value": true + }, + "particle": { + "_value": false + }, + "physics": { + "_value": false, + "_option": "physics-ammo" + }, + "physics-ammo": { + "_value": true, + "_flags": { + "LOAD_BULLET_MANUALLY": false + } + }, + "physics-cannon": { + "_value": false + }, + "physics-physx": { + "_value": false, + "_flags": { + "LOAD_PHYSX_MANUALLY": false + } + }, + "physics-builtin": { + "_value": false + }, + "physics-2d": { + "_value": true, + "_option": "physics-2d-box2d-wasm" + }, + "physics-2d-box2d": { + "_value": true + }, + "physics-2d-box2d-wasm": { + "_value": false, + "_flags": { + "LOAD_BOX2D_MANUALLY": false + } + }, + "physics-2d-builtin": { + "_value": false + }, + "physics-2d-box2d-jsb": { + "_value": false + }, + "intersection-2d": { + "_value": true + }, + "primitive": { + "_value": false + }, + "profiler": { + "_value": true + }, + "occlusion-query": { + "_value": false + }, + "geometry-renderer": { + "_value": false + }, + "debug-renderer": { + "_value": false + }, + "particle-2d": { + "_value": true + }, + "audio": { + "_value": true + }, + "video": { + "_value": false + }, + "webview": { + "_value": false + }, + "tween": { + "_value": true + }, + "websocket": { + "_value": false + }, + "websocket-server": { + "_value": false + }, + "terrain": { + "_value": false + }, + "light-probe": { + "_value": false + }, + "tiled-map": { + "_value": true + }, + "vendor-google": { + "_value": false + }, + "spine": { + "_value": false, + "_option": "spine-3.8" + }, + "spine-3.8": { + "_value": true, + "_flags": { + "LOAD_SPINE_MANUALLY": false + } + }, + "spine-4.2": { + "_value": false, + "_flags": { + "LOAD_SPINE_MANUALLY": false + } + }, + "dragon-bones": { + "_value": false + }, + "marionette": { + "_value": true + }, + "procedural-animation": { + "_value": true + }, + "custom-pipeline-post-process": { + "_value": false + }, + "render-pipeline": { + "_value": true, + "_option": "custom-pipeline" + }, + "custom-pipeline": { + "_value": true + }, + "legacy-pipeline": { + "_value": false + }, + "xr": { + "_value": false + } + }, + "flags": { + "LOAD_BOX2D_MANUALLY": false + }, + "name": "box2d-wasm", + "includeModules": [ + "2d", + "affine-transform", + "animation", + "audio", + "base", + "custom-pipeline", + "gfx-webgl", + "graphics", + "intersection-2d", + "marionette", + "mask", + "particle-2d", + "physics-2d-box2d-wasm", + "procedural-animation", + "profiler", + "rich-text", + "skeletal-animation", + "tiled-map", + "tween", + "ui", + "ui-skew" + ], + "noDeprecatedFeatures": { + "value": false, + "version": "" + } + }, + "custom-config-1150780a-849d-43e6-b2f1-698a3c004529": { + "name": "box2d-jsb", + "cache": { + "base": { + "_value": true + }, + "gfx-webgl": { + "_value": true + }, + "gfx-webgl2": { + "_value": false + }, + "gfx-webgpu": { + "_value": false + }, + "animation": { + "_value": true + }, + "skeletal-animation": { + "_value": true + }, + "3d": { + "_value": true + }, + "meshopt": { + "_value": false + }, + "2d": { + "_value": true + }, + "sorting-2d": { + "_value": false + }, + "rich-text": { + "_value": true + }, + "mask": { + "_value": true + }, + "graphics": { + "_value": true + }, + "ui-skew": { + "_value": true + }, + "affine-transform": { + "_value": true + }, + "ui": { + "_value": true + }, + "particle": { + "_value": true + }, + "physics": { + "_value": true, + "_option": "physics-ammo" + }, + "physics-ammo": { + "_value": true, + "_flags": { + "LOAD_BULLET_MANUALLY": false + } + }, + "physics-cannon": { + "_value": false + }, + "physics-physx": { + "_value": false, + "_flags": { + "LOAD_PHYSX_MANUALLY": false + } + }, + "physics-builtin": { + "_value": false + }, + "physics-2d": { + "_value": true, + "_option": "physics-2d-box2d-jsb" + }, + "physics-2d-box2d": { + "_value": true + }, + "physics-2d-box2d-wasm": { + "_value": false, + "_flags": { + "LOAD_BOX2D_MANUALLY": false + } + }, + "physics-2d-builtin": { + "_value": false + }, + "physics-2d-box2d-jsb": { + "_value": false + }, + "intersection-2d": { + "_value": true + }, + "primitive": { + "_value": true + }, + "profiler": { + "_value": true + }, + "occlusion-query": { + "_value": false + }, + "geometry-renderer": { + "_value": false + }, + "debug-renderer": { + "_value": false + }, + "particle-2d": { + "_value": true + }, + "audio": { + "_value": true + }, + "video": { + "_value": true + }, + "webview": { + "_value": true + }, + "tween": { + "_value": true + }, + "websocket": { + "_value": true + }, + "websocket-server": { + "_value": false + }, + "terrain": { + "_value": true + }, + "light-probe": { + "_value": true + }, + "tiled-map": { + "_value": true + }, + "vendor-google": { + "_value": false + }, + "spine": { + "_value": true, + "_option": "spine-3.8" + }, + "spine-3.8": { + "_value": true, + "_flags": { + "LOAD_SPINE_MANUALLY": false + } + }, + "spine-4.2": { + "_value": false, + "_flags": { + "LOAD_SPINE_MANUALLY": false + } + }, + "dragon-bones": { + "_value": true + }, + "marionette": { + "_value": true + }, + "procedural-animation": { + "_value": false + }, + "custom-pipeline-post-process": { + "_value": false + }, + "render-pipeline": { + "_value": true, + "_option": "custom-pipeline" + }, + "custom-pipeline": { + "_value": true + }, + "legacy-pipeline": { + "_value": false + }, + "xr": { + "_value": false + } + }, + "flags": { + "LOAD_SPINE_MANUALLY": false, + "LOAD_BULLET_MANUALLY": false + }, + "includeModules": [ + "2d", + "3d", + "affine-transform", + "animation", + "audio", + "base", + "custom-pipeline", + "dragon-bones", + "gfx-webgl", + "graphics", + "intersection-2d", + "light-probe", + "marionette", + "mask", + "particle", + "particle-2d", + "physics-2d-box2d-jsb", + "physics-ammo", + "primitive", + "profiler", + "rich-text", + "skeletal-animation", + "spine-3.8", + "terrain", + "tiled-map", + "tween", + "ui", + "ui-skew", + "video", + "websocket", + "webview" + ], + "noDeprecatedFeatures": { + "value": false, + "version": "" + } + }, + "custom-config-1dbc2191-0126-4ff3-be72-5c1d44c4635d": { + "name": "sconanim", + "cache": { + "base": { + "_value": true + }, + "gfx-webgl": { + "_value": true + }, + "gfx-webgl2": { + "_value": false + }, + "gfx-webgpu": { + "_value": false + }, + "animation": { + "_value": false + }, + "skeletal-animation": { + "_value": false + }, + "3d": { + "_value": false + }, + "meshopt": { + "_value": false + }, + "2d": { + "_value": true + }, + "sorting-2d": { + "_value": false + }, + "rich-text": { + "_value": false + }, + "mask": { + "_value": false + }, + "graphics": { + "_value": false + }, + "ui-skew": { + "_value": false + }, + "affine-transform": { + "_value": false + }, + "ui": { + "_value": true + }, + "particle": { + "_value": false + }, + "physics": { + "_value": false, + "_option": "physics-ammo" + }, + "physics-ammo": { + "_value": true, + "_flags": { + "LOAD_BULLET_MANUALLY": false + } + }, + "physics-cannon": { + "_value": false + }, + "physics-physx": { + "_value": false, + "_flags": { + "LOAD_PHYSX_MANUALLY": false + } + }, + "physics-builtin": { + "_value": false + }, + "physics-2d": { + "_value": false, + "_option": "physics-2d-box2d" + }, + "physics-2d-box2d": { + "_value": true + }, + "physics-2d-box2d-wasm": { + "_value": false, + "_flags": { + "LOAD_BOX2D_MANUALLY": false + } + }, + "physics-2d-builtin": { + "_value": false + }, + "physics-2d-box2d-jsb": { + "_value": false + }, + "intersection-2d": { + "_value": false + }, + "primitive": { + "_value": false + }, + "profiler": { + "_value": true + }, + "occlusion-query": { + "_value": false + }, + "geometry-renderer": { + "_value": false + }, + "debug-renderer": { + "_value": false + }, + "particle-2d": { + "_value": false + }, + "audio": { + "_value": false + }, + "video": { + "_value": false + }, + "webview": { + "_value": false + }, + "tween": { + "_value": true + }, + "websocket": { + "_value": false + }, + "websocket-server": { + "_value": false + }, + "terrain": { + "_value": false + }, + "light-probe": { + "_value": false + }, + "tiled-map": { + "_value": false + }, + "vendor-google": { + "_value": false + }, + "spine": { + "_value": false, + "_option": "spine-3.8" + }, + "spine-3.8": { + "_value": true, + "_flags": { + "LOAD_SPINE_MANUALLY": false + } + }, + "spine-4.2": { + "_value": false, + "_flags": { + "LOAD_SPINE_MANUALLY": false + } + }, + "dragon-bones": { + "_value": false + }, + "marionette": { + "_value": true + }, + "procedural-animation": { + "_value": true + }, + "custom-pipeline-post-process": { + "_value": false + }, + "render-pipeline": { + "_value": true, + "_option": "custom-pipeline" + }, + "custom-pipeline": { + "_value": true + }, + "legacy-pipeline": { + "_value": false + }, + "xr": { + "_value": false + } + }, + "flags": {}, + "includeModules": [ + "2d", + "base", + "custom-pipeline", + "gfx-webgl", + "marionette", + "procedural-animation", + "profiler", + "tween", + "ui" + ], + "noDeprecatedFeatures": { + "value": false, + "version": "" + } + } + }, + "globalConfigKey": "custom-config-91330ba4-1f85-4d2a-a0d4-55133639da0c" + } +} diff --git a/tools/flashfin-rapier2d/settings/v2/packages/information.json b/tools/flashfin-rapier2d/settings/v2/packages/information.json new file mode 100644 index 0000000..0ce9f9b --- /dev/null +++ b/tools/flashfin-rapier2d/settings/v2/packages/information.json @@ -0,0 +1,23 @@ +{ + "__version__": "1.0.1", + "information": { + "customSplash": { + "id": "customSplash", + "label": "customSplash", + "enable": true, + "customSplash": { + "complete": false, + "form": "https://creator-api.cocos.com/api/form/show?sid=311ddac62fb285889cb7ed40438bbd50" + } + }, + "removeSplash": { + "id": "removeSplash", + "label": "removeSplash", + "enable": true, + "removeSplash": { + "complete": false, + "form": "https://creator-api.cocos.com/api/form/show?sid=311ddac62fb285889cb7ed40438bbd50" + } + } + } +} diff --git a/tools/flashfin-rapier2d/settings/v2/packages/program.json b/tools/flashfin-rapier2d/settings/v2/packages/program.json new file mode 100644 index 0000000..916c1b2 --- /dev/null +++ b/tools/flashfin-rapier2d/settings/v2/packages/program.json @@ -0,0 +1,3 @@ +{ + "__version__": "1.0.4" +} diff --git a/tools/flashfin-rapier2d/settings/v2/packages/project.json b/tools/flashfin-rapier2d/settings/v2/packages/project.json new file mode 100644 index 0000000..41fc884 --- /dev/null +++ b/tools/flashfin-rapier2d/settings/v2/packages/project.json @@ -0,0 +1,29 @@ +{ + "__version__": "1.0.6", + "general": { + "designResolution": { + "width": 1624, + "height": 750, + "fitHeight": true, + "fitWidth": false + } + }, + "custom_joint_texture_layouts": [], + "physics": { + "collisionGroups": [ + { + "index": 1, + "name": "WALL" + }, + { + "index": 2, + "name": "BALL" + } + ], + "collisionMatrix": { + "0": 1, + "1": 4, + "2": 6 + } + } +} diff --git a/tools/flashfin-rapier2d/settings/v2/packages/scene.json b/tools/flashfin-rapier2d/settings/v2/packages/scene.json new file mode 100644 index 0000000..4cacb76 --- /dev/null +++ b/tools/flashfin-rapier2d/settings/v2/packages/scene.json @@ -0,0 +1,4 @@ +{ + "__version__": "1.0.3", + "current-scene": "452ca018-6ac2-414a-966a-166c7c8f4c30" +} diff --git a/tools/flashfin-rapier2d/tsconfig.json b/tools/flashfin-rapier2d/tsconfig.json new file mode 100644 index 0000000..8b5ad3c --- /dev/null +++ b/tools/flashfin-rapier2d/tsconfig.json @@ -0,0 +1,10 @@ +{ + /* Base configuration. Do not edit this field. */ + "extends": "./temp/tsconfig.cocos.json", + + /* Add your custom configuration here. */ + "compilerOptions": { + "strict": false, + "allowSyntheticDefaultImports": true + } +}