Skip to content

Commit

Permalink
Support Collada
Browse files Browse the repository at this point in the history
  • Loading branch information
polyhobbyist committed Apr 18, 2023
1 parent 6d86fef commit ff67829
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
37 changes: 37 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@
},
"dependencies": {
"@polyhobbyist/babylon_ros": "^0.0.1",
"@polyhobbyist/babylon-collada-loader": "^0.0.2",
"@vscode/debugadapter": "^1.59.0",
"@vscode/extension-telemetry": "^0.6.2",
"@vscode/webview-ui-toolkit": "^1.2.1",
Expand Down
7 changes: 6 additions & 1 deletion src/urdfPreview/URDFPreviewPanel.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as BABYLON from 'babylonjs';
import * as Materials from 'babylonjs-materials';
import * as urdf from '@polyhobbyist/babylon_ros';
import * as ColladaFileLoader from '@polyhobbyist/babylon-collada-loader';

// Get access to the VS Code API from within the webview context
const vscode = acquireVsCodeApi();
Expand Down Expand Up @@ -36,6 +37,10 @@ function applyAxisToJoint(scene : BABYLON.Scene, robot : urdf.Robot, j : string)

var createScene = async function () {
scene = new BABYLON.Scene(engine);
if (BABYLON.SceneLoader) {
//Add this loader into the register plugin
BABYLON.SceneLoader.RegisterPlugin(new ColladaFileLoader.DAEFileLoader());
}

// This creates a basic Babylon Scene object (non-mesh)
// Create a default ground and skybox.
Expand All @@ -56,7 +61,7 @@ var createScene = async function () {
camera.wheelDeltaPercentage = 0.01;
camera.minZ = 0.1;

const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0), scene);
const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0), scene);

// This attaches the camera to the canvas
camera.attachControl(canvas, true);
Expand Down

0 comments on commit ff67829

Please sign in to comment.