@certe/atmos-editor 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/atmos-init.mjs +47 -4
- package/package.json +6 -6
package/bin/atmos-init.mjs
CHANGED
|
@@ -330,16 +330,59 @@ Set \`emissive\` + \`emissiveIntensity\` > 0 for glowing objects (works with blo
|
|
|
330
330
|
|
|
331
331
|
\`\`\`typescript
|
|
332
332
|
import { RigidBody, Collider, Physics } from '@certe/atmos-physics';
|
|
333
|
+
import { Vec3 } from '@certe/atmos-math';
|
|
333
334
|
|
|
334
|
-
// Apply force
|
|
335
|
+
// Apply force / impulse (wrapper methods, safe even if body isn't ready yet)
|
|
335
336
|
const rb = this.getComponent(RigidBody);
|
|
336
|
-
rb.
|
|
337
|
+
rb.addImpulse(0, 10, 0);
|
|
338
|
+
rb.addForce(0, 50, 0);
|
|
337
339
|
|
|
338
|
-
// Raycast
|
|
339
|
-
const
|
|
340
|
+
// Raycast (Physics.current is set automatically)
|
|
341
|
+
const origin = Vec3.fromValues(0, 1, 0);
|
|
342
|
+
const dir = Vec3.fromValues(0, 0, -1);
|
|
343
|
+
const hit = Physics.raycast(origin, dir, 100);
|
|
340
344
|
if (hit) {
|
|
341
345
|
console.log(hit.gameObject.name, hit.point, hit.distance);
|
|
342
346
|
}
|
|
347
|
+
|
|
348
|
+
// Overlap queries
|
|
349
|
+
const center = Vec3.fromValues(0, 0, 0);
|
|
350
|
+
const sphereHit = Physics.sphereCast(center, 2.0);
|
|
351
|
+
const boxHits = Physics.boxCastAll(center, Vec3.fromValues(1, 1, 1));
|
|
352
|
+
\`\`\`
|
|
353
|
+
|
|
354
|
+
### Creating Physics Objects at Runtime
|
|
355
|
+
|
|
356
|
+
Physics components auto-initialize on the next physics step. Just add
|
|
357
|
+
components and set properties — no manual \`init()\` needed:
|
|
358
|
+
|
|
359
|
+
\`\`\`typescript
|
|
360
|
+
import { Component, GameObject, Scene, Input } from '@certe/atmos-core';
|
|
361
|
+
import { RigidBody, Collider } from '@certe/atmos-physics';
|
|
362
|
+
|
|
363
|
+
export class BallSpawner extends Component {
|
|
364
|
+
onUpdate(dt: number) {
|
|
365
|
+
if (!Input.current!.getKeyDown('Space')) return;
|
|
366
|
+
|
|
367
|
+
const ball = new GameObject('Ball');
|
|
368
|
+
Scene.current!.add(ball);
|
|
369
|
+
ball.transform.setPosition(0, 5, 0);
|
|
370
|
+
|
|
371
|
+
const rb = ball.addComponent(RigidBody);
|
|
372
|
+
rb.bodyType = 'dynamic';
|
|
373
|
+
|
|
374
|
+
const col = ball.addComponent(Collider);
|
|
375
|
+
col.shape = { type: 'sphere', radius: 0.5 };
|
|
376
|
+
col.restitution = 0.8;
|
|
377
|
+
// Physics auto-activates on the next frame
|
|
378
|
+
|
|
379
|
+
// To apply impulse, wait until body is ready (next frame):
|
|
380
|
+
// rb.addImpulse(0, 10, 0);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// Cleanup — removing from scene auto-removes Rapier resources:
|
|
385
|
+
// Scene.current!.remove(ball);
|
|
343
386
|
\`\`\`
|
|
344
387
|
|
|
345
388
|
## Editor Properties
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certe/atmos-editor",
|
|
3
3
|
"description": "Browser-based Unity-style editor for the Atmos Engine — hierarchy, inspector, gizmos",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/certesolutions-cyber/atmos.git",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@certe/atmos-animation": "^0.
|
|
60
|
-
"@certe/atmos-assets": "^0.
|
|
61
|
-
"@certe/atmos-core": "^0.
|
|
62
|
-
"@certe/atmos-math": "^0.
|
|
63
|
-
"@certe/atmos-renderer": "^0.
|
|
59
|
+
"@certe/atmos-animation": "^0.8.0",
|
|
60
|
+
"@certe/atmos-assets": "^0.8.0",
|
|
61
|
+
"@certe/atmos-core": "^0.8.0",
|
|
62
|
+
"@certe/atmos-math": "^0.8.0",
|
|
63
|
+
"@certe/atmos-renderer": "^0.8.0",
|
|
64
64
|
"react": "^19.0.0",
|
|
65
65
|
"react-dom": "^19.0.0"
|
|
66
66
|
},
|