mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
avatar fbx parsing yay
This commit is contained in:
parent
106c140bd4
commit
90ce52a2ae
1 changed files with 30 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
var utilsPath = Script.resolvePath("../utils.js");
|
||||
Script.include(utilsPath);
|
||||
var avatarModelURL;
|
||||
|
||||
DressingRoom = function() {
|
||||
return this
|
||||
|
@ -11,6 +12,7 @@
|
|||
preload: function(entityID) {
|
||||
print('PRELOAD DRESSING ROOM');
|
||||
this.entityID = entityID;
|
||||
avatarModelURL = getAvatarFBX();
|
||||
},
|
||||
enterEntity: function() {
|
||||
print('ENTER DRESSING ROOM');
|
||||
|
@ -45,7 +47,7 @@
|
|||
this.cleanup();
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// doppelganger.js
|
||||
//
|
||||
|
@ -58,7 +60,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
var TEST_MODEL_URL = 'https://s3.amazonaws.com/hifi-public/ozan/avatars/albert/albert/albert.fbx';
|
||||
|
||||
|
||||
var MIRROR_JOINT_DATA = true;
|
||||
var MIRRORED_ENTITY_SCRIPT_URL = Script.resolvePath('mirroredEntity.js');
|
||||
|
@ -73,7 +75,7 @@
|
|||
this.initialProperties = {
|
||||
name: 'Hifi-Doppelganger',
|
||||
type: 'Model',
|
||||
modelURL: TEST_MODEL_URL,
|
||||
modelURL: avatarModelURL,
|
||||
// dimensions: getAvatarDimensions(avatar),
|
||||
position: putDoppelgangerAcrossFromAvatar(this, avatar),
|
||||
rotation: rotateDoppelgangerTowardAvatar(this, avatar),
|
||||
|
@ -93,6 +95,31 @@
|
|||
return this;
|
||||
}
|
||||
|
||||
function getAvatarFBX() {
|
||||
var skeletonURL = MyAvatar.skeletonModelURL;
|
||||
var req = new XMLHttpRequest();
|
||||
req.open("GET", skeletonURL, false);
|
||||
req.send();
|
||||
|
||||
var fst = req.responseText;
|
||||
|
||||
var fbxURL;
|
||||
|
||||
var split = fst.split('\n');
|
||||
split.forEach(function(line) {
|
||||
if (line.indexOf('filename') > -1) {
|
||||
var innerSplit = line.split(" ");
|
||||
innerSplit.forEach(function(inner) {
|
||||
if (inner.indexOf('.fbx') > -1) {
|
||||
fbxURL = inner;
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
return fbxURL
|
||||
}
|
||||
|
||||
function getJointData(avatar) {
|
||||
var allJointData = [];
|
||||
var jointNames = MyAvatar.jointNames;
|
||||
|
|
Loading…
Reference in a new issue