mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 07:23:51 +02: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");
|
var utilsPath = Script.resolvePath("../utils.js");
|
||||||
Script.include(utilsPath);
|
Script.include(utilsPath);
|
||||||
|
var avatarModelURL;
|
||||||
|
|
||||||
DressingRoom = function() {
|
DressingRoom = function() {
|
||||||
return this
|
return this
|
||||||
|
@ -11,6 +12,7 @@
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
print('PRELOAD DRESSING ROOM');
|
print('PRELOAD DRESSING ROOM');
|
||||||
this.entityID = entityID;
|
this.entityID = entityID;
|
||||||
|
avatarModelURL = getAvatarFBX();
|
||||||
},
|
},
|
||||||
enterEntity: function() {
|
enterEntity: function() {
|
||||||
print('ENTER DRESSING ROOM');
|
print('ENTER DRESSING ROOM');
|
||||||
|
@ -45,7 +47,7 @@
|
||||||
this.cleanup();
|
this.cleanup();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// doppelganger.js
|
// doppelganger.js
|
||||||
//
|
//
|
||||||
|
@ -58,7 +60,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// 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 MIRROR_JOINT_DATA = true;
|
||||||
var MIRRORED_ENTITY_SCRIPT_URL = Script.resolvePath('mirroredEntity.js');
|
var MIRRORED_ENTITY_SCRIPT_URL = Script.resolvePath('mirroredEntity.js');
|
||||||
|
@ -73,7 +75,7 @@
|
||||||
this.initialProperties = {
|
this.initialProperties = {
|
||||||
name: 'Hifi-Doppelganger',
|
name: 'Hifi-Doppelganger',
|
||||||
type: 'Model',
|
type: 'Model',
|
||||||
modelURL: TEST_MODEL_URL,
|
modelURL: avatarModelURL,
|
||||||
// dimensions: getAvatarDimensions(avatar),
|
// dimensions: getAvatarDimensions(avatar),
|
||||||
position: putDoppelgangerAcrossFromAvatar(this, avatar),
|
position: putDoppelgangerAcrossFromAvatar(this, avatar),
|
||||||
rotation: rotateDoppelgangerTowardAvatar(this, avatar),
|
rotation: rotateDoppelgangerTowardAvatar(this, avatar),
|
||||||
|
@ -93,6 +95,31 @@
|
||||||
return this;
|
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) {
|
function getJointData(avatar) {
|
||||||
var allJointData = [];
|
var allJointData = [];
|
||||||
var jointNames = MyAvatar.jointNames;
|
var jointNames = MyAvatar.jointNames;
|
||||||
|
|
Loading…
Reference in a new issue