mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
Support for model overrides for equip hotspots rendering
Bug fix for modelScale on hotspots
This commit is contained in:
parent
0ce970408c
commit
f3ef2801b4
1 changed files with 32 additions and 16 deletions
|
@ -420,20 +420,30 @@ EquipHotspotBuddy.prototype.updateHotspot = function (hotspot, timestamp) {
|
||||||
|
|
||||||
var diameter = hotspot.radius * 2;
|
var diameter = hotspot.radius * 2;
|
||||||
|
|
||||||
// TODO: check for custom hotspot model urls.
|
if (hotspot.modelURL) {
|
||||||
|
// override default sphere with a user specified model
|
||||||
// default sphere
|
overlayInfoSet.overlays.push(Overlays.addOverlay("model", {
|
||||||
overlayInfoSet.overlays.push(Overlays.addOverlay("sphere", {
|
url: hotspot.modelURL,
|
||||||
position: hotspot.worldPosition,
|
position: hotspot.worldPosition,
|
||||||
rotation: {x: 0, y: 0, z: 0, w: 1},
|
rotation: {x: 0, y: 0, z: 0, w: 1},
|
||||||
dimensions: diameter * EQUIP_SPHERE_SCALE_FACTOR,
|
dimensions: diameter * EQUIP_SPHERE_SCALE_FACTOR,
|
||||||
color: EQUIP_SPHERE_COLOR,
|
scale: hotspot.modelScale,
|
||||||
alpha: EQUIP_SPHERE_ALPHA,
|
ignoreRayIntersection: true
|
||||||
solid: true,
|
}));
|
||||||
visible: true,
|
} else {
|
||||||
ignoreRayIntersection: true,
|
// default sphere overlay
|
||||||
drawInFront: false
|
overlayInfoSet.overlays.push(Overlays.addOverlay("sphere", {
|
||||||
}));
|
position: hotspot.worldPosition,
|
||||||
|
rotation: {x: 0, y: 0, z: 0, w: 1},
|
||||||
|
dimensions: diameter * EQUIP_SPHERE_SCALE_FACTOR,
|
||||||
|
color: EQUIP_SPHERE_COLOR,
|
||||||
|
alpha: EQUIP_SPHERE_ALPHA,
|
||||||
|
solid: true,
|
||||||
|
visible: true,
|
||||||
|
ignoreRayIntersection: true,
|
||||||
|
drawInFront: false
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
this.map[hotspot.key] = overlayInfoSet;
|
this.map[hotspot.key] = overlayInfoSet;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1119,6 +1129,8 @@ function MyController(hand) {
|
||||||
// * radius {number} radius of equip hotspot
|
// * radius {number} radius of equip hotspot
|
||||||
// * joints {Object} keys are joint names values are arrays of two elements:
|
// * joints {Object} keys are joint names values are arrays of two elements:
|
||||||
// offset position {Vec3} and offset rotation {Quat}, both are in the coordinate system of the joint.
|
// offset position {Vec3} and offset rotation {Quat}, both are in the coordinate system of the joint.
|
||||||
|
// * modelURL {string} url for model to use instead of default sphere.
|
||||||
|
// * modelScale {Vec3} scale factor for model
|
||||||
this.collectEquipHotspots = function (entityID) {
|
this.collectEquipHotspots = function (entityID) {
|
||||||
var result = [];
|
var result = [];
|
||||||
var props = entityPropertiesCache.getProps(entityID);
|
var props = entityPropertiesCache.getProps(entityID);
|
||||||
|
@ -1135,7 +1147,9 @@ function MyController(hand) {
|
||||||
localPosition: hotspot.position,
|
localPosition: hotspot.position,
|
||||||
worldPosition: entityXform.xformPoint(hotspot.position),
|
worldPosition: entityXform.xformPoint(hotspot.position),
|
||||||
radius: hotspot.radius,
|
radius: hotspot.radius,
|
||||||
joints: hotspot.joints
|
joints: hotspot.joints,
|
||||||
|
modelURL: hotspot.modelURL,
|
||||||
|
modelScale: hotspot.modelScale
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1148,7 +1162,9 @@ function MyController(hand) {
|
||||||
localPosition: {x: 0, y: 0, z: 0},
|
localPosition: {x: 0, y: 0, z: 0},
|
||||||
worldPosition: entityXform.pos,
|
worldPosition: entityXform.pos,
|
||||||
radius: EQUIP_RADIUS,
|
radius: EQUIP_RADIUS,
|
||||||
joints: wearableProps.joints
|
joints: wearableProps.joints,
|
||||||
|
modelURL: null,
|
||||||
|
modelScale: null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue