Skip to content

Commit

Permalink
Add back the test for the Rigid Body component
Browse files Browse the repository at this point in the history
Adds back the test for the Rigid Body component that was removed when the scene grabbables support was removed (#319).
  • Loading branch information
Exairnous committed Nov 26, 2024
1 parent 9bda22a commit 8954d01
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
Binary file added tests/scenes/rigid-body.blend
Binary file not shown.
65 changes: 65 additions & 0 deletions tests/test/tests/rigid-body.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const fs = require('fs');
const path = require('path');
const assert = require('assert');
const utils = require('../utils.js');

module.exports = {
description: 'can export rigid-body',
test: outDirPath => {
let gltfPath = path.resolve(outDirPath, 'rigid-body.gltf');
const asset = JSON.parse(fs.readFileSync(gltfPath));

assert.strictEqual(asset.extensionsUsed.includes('MOZ_hubs_components'), true);
assert.strictEqual(utils.checkExtensionAdded(asset, 'MOZ_hubs_components'), true);

const node = asset.nodes[0];
assert.strictEqual(utils.checkExtensionAdded(node, 'MOZ_hubs_components'), true);

const ext = node.extensions['MOZ_hubs_components'];
assert.deepStrictEqual(ext, {
"rigidbody":{
"type":"dynamic",
"disableCollision":false,
"collisionGroup":"objects",
"collisionMask":[
"objects",
"triggers",
"environment"
],
"mass":1,
"linearDamping":0,
"angularDamping":0,
"linearSleepingThreshold":0.800000011920929,
"angularSleepingThreshold":1,
"angularFactor":[
1,
1,
1
],
"gravity":[
0,
-9.800000190734863,
0
]
},
"physics-shape":{
"type":"hull",
"fit":"all",
"halfExtents":{
"x":0.5,
"y":0.5,
"z":0.5
},
"minHalfExtent":0,
"maxHalfExtent":1000,
"sphereRadius":0.5,
"offset":{
"x":0,
"y":0,
"z":0
},
"includeInvisible":false
}
});
}
};

0 comments on commit 8954d01

Please sign in to comment.