Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions box2d-ball/.dclignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.*
bin/*.map
package-lock.json
yarn-lock.json
build.json
export
tsconfig.json
tslint.json
node_modules
*.ts
*.tsx
.vscode
Dockerfile
dist
README.md
*.blend
*.fbx
*.zip
*.rar
src
19 changes: 19 additions & 0 deletions box2d-ball/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: test-build

on:
push:
pull_request:

jobs:
lint-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: install dependencies
run: npm install
- name: npm run build
run: npm run build
9 changes: 9 additions & 0 deletions box2d-ball/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package-lock.json
*.js
node_modules
bin/
.DS_Store
**/.DS_Store
npm-debug.log*
yarn-debug.log*
yarn-error.log*
3 changes: 3 additions & 0 deletions box2d-ball/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["decentralandfoundation.decentraland-sdk7"]
}
17 changes: 17 additions & 0 deletions box2d-ball/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use the Decentraland Editor extension of VSCode to debug the scene
// in chrome from VSCode
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Debug Decentraland in Chrome",
"url": "${command:decentraland-sdk7.commands.getDebugURL}",
"webRoot": "${workspaceFolder}/bin",
"sourceMapPathOverrides": {
"dcl:///*": "${workspaceFolder}/*"
}
}
]
}
31 changes: 31 additions & 0 deletions box2d-ball/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Box2D Ball Example Scene (SDK7 Version)

_demo of box2d-ball-example-scene running in preview._

![demo](https://github.com/sdk7-goerli-plaza/box2d-ball-example-scene/blob/master/screenshots/bouncing-ball.gif)

## Description

Simulating a bouncing ball using the [box2d.ts](https://github.com/flyover/box2d.ts) physics engine.

## Instructions

Press the <kbd>E</kbd> key to reset the scene.

## Try it out

**Previewing the scene**

1. Download this full repository from [sdk7-goerli-plaza](https://github.com/decentraland/sdk7-goerli-plaza/tree/main), including this and several other example scenes on SDK7.

2. Install the [Decentraland Editor](https://docs.decentraland.org/creator/development-guide/sdk7/editor/)

3. Open a Visual Studio Code window on this scene's root folder. Not on the root folder of the whole repo, but instead on this sub-folder that belongs to the scene.

4. Open the Decentraland Editor tab, and press **Run Scene**

Alternatively, you can use the command line. Inside this scene root directory run:

```
npm run start
```
262 changes: 262 additions & 0 deletions box2d-ball/assets/scene/main.composite
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
{
"version": 1,
"components": [
{
"name": "core::Transform",
"jsonSchema": {
"type": "object",
"properties": {
"position": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"z": {
"type": "number"
}
}
},
"scale": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"z": {
"type": "number"
}
}
},
"rotation": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"z": {
"type": "number"
},
"w": {
"type": "number"
}
}
},
"parent": {
"type": "integer"
}
},
"serializationType": "transform"
},
"data": {
"512": {
"json": {
"position": {
"x": 8,
"y": 1,
"z": 8
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"rotation": {
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"parent": 0
}
}
}
},
{
"name": "core::MeshRenderer",
"jsonSchema": {
"type": "object",
"properties": {},
"serializationType": "protocol-buffer",
"protocolBuffer": "PBMeshRenderer"
},
"data": {
"512": {
"json": {
"mesh": {
"$case": "box",
"box": {
"uvs": []
}
}
}
}
}
},
{
"name": "core-schema::Name",
"jsonSchema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"serializationType": "utf8-string"
}
},
"serializationType": "map"
},
"data": {
"512": {
"json": {
"value": "Magic Cube"
}
}
}
},
{
"name": "inspector::Scene",
"jsonSchema": {
"type": "object",
"properties": {
"layout": {
"type": "object",
"properties": {
"base": {
"type": "object",
"properties": {
"x": {
"type": "integer",
"serializationType": "int32"
},
"y": {
"type": "integer",
"serializationType": "int32"
}
},
"serializationType": "map"
},
"parcels": {
"type": "array",
"items": {
"type": "object",
"properties": {
"x": {
"type": "integer",
"serializationType": "int32"
},
"y": {
"type": "integer",
"serializationType": "int32"
}
},
"serializationType": "map"
},
"serializationType": "array"
}
},
"serializationType": "map"
}
},
"serializationType": "map"
},
"data": {
"0": {
"json": {
"layout": {
"base": {
"x": 0,
"y": 0
},
"parcels": [
{
"x": 0,
"y": 0
}
]
}
}
}
}
},
{
"name": "inspector::Nodes",
"jsonSchema": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"type": "object",
"properties": {
"entity": {
"type": "integer",
"serializationType": "entity"
},
"open": {
"type": "boolean",
"serializationType": "optional",
"optionalJsonSchema": {
"type": "boolean",
"serializationType": "boolean"
}
},
"children": {
"type": "array",
"items": {
"type": "integer",
"serializationType": "entity"
},
"serializationType": "array"
}
},
"serializationType": "map"
},
"serializationType": "array"
}
},
"serializationType": "map"
},
"data": {
"0": {
"json": {
"value": [
{
"entity": 0,
"children": [
512
],
"open": true
},
{
"entity": 512,
"children": []
}
]
}
}
}
},
{
"name": "cube-id",
"jsonSchema": {
"type": "object",
"properties": {},
"serializationType": "map"
},
"data": {
"512": {
"json": {}
}
}
}
]
}
Binary file added box2d-ball/images/scene-thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added box2d-ball/models/baseScene.glb
Binary file not shown.
19 changes: 19 additions & 0 deletions box2d-ball/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "box2d-ball-example-scene",
"description": "Box2D Ball Example Scene (SDK7 Version)",
"version": "1.0.0",
"dependencies": {
"box2d.ts": "^1.0.2"
},
"devDependencies": {
"@dcl/js-runtime": "latest",
"@dcl/sdk": "latest"
},
"scripts": {
"build": "sdk-commands build",
"deploy": "sdk-commands deploy",
"start": "sdk-commands start",
"upgrade-sdk": "npm install --save-dev @dcl/sdk@latest",
"upgrade-sdk:next": "npm install --save-dev @dcl/sdk@next"
}
}
Loading