mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:28:02 +02:00
Re-enable storing of attach points in user settings
* bug fix, use localOffset property of grabbed entity, which is dynamically updated as the near grab action moves the entity.
This commit is contained in:
parent
dc2741950a
commit
4b2fb546eb
1 changed files with 5 additions and 12 deletions
|
@ -271,8 +271,7 @@ function propsArePhysical(props) {
|
||||||
return isPhysical;
|
return isPhysical;
|
||||||
}
|
}
|
||||||
|
|
||||||
// currently disabled.
|
var USE_ATTACH_POINT_SETTINGS = true;
|
||||||
var USE_ATTACH_POINT_SETTINGS = false;
|
|
||||||
|
|
||||||
var ATTACH_POINT_SETTINGS = "io.highfidelity.attachPoints";
|
var ATTACH_POINT_SETTINGS = "io.highfidelity.attachPoints";
|
||||||
function getAttachPointSettings() {
|
function getAttachPointSettings() {
|
||||||
|
@ -2091,16 +2090,10 @@ function MyController(hand) {
|
||||||
this.holdExit = function () {
|
this.holdExit = function () {
|
||||||
// store the offset attach points into preferences.
|
// store the offset attach points into preferences.
|
||||||
if (USE_ATTACH_POINT_SETTINGS && this.grabbedHotspot && this.grabbedEntity) {
|
if (USE_ATTACH_POINT_SETTINGS && this.grabbedHotspot && this.grabbedEntity) {
|
||||||
entityPropertiesCache.addEntity(this.grabbedEntity);
|
var props = Entities.getEntityProperties(this.grabbedEntity, ["localPosition", "localRotation"]);
|
||||||
var props = entityPropertiesCache.getProps(this.grabbedEntity);
|
if (props && props.localPosition && props.localRotation) {
|
||||||
var entityXform = new Xform(props.rotation, props.position);
|
storeAttachPointForHotspotInSettings(this.grabbedHotspot, this.hand, props.localPosition, props.localRotation);
|
||||||
var avatarXform = new Xform(MyAvatar.orientation, MyAvatar.position);
|
}
|
||||||
var handRot = (this.hand === RIGHT_HAND) ? MyAvatar.getRightPalmRotation() : MyAvatar.getLeftPalmRotation();
|
|
||||||
var avatarHandPos = (this.hand === RIGHT_HAND) ? MyAvatar.rightHandPosition : MyAvatar.leftHandPosition;
|
|
||||||
var palmXform = new Xform(handRot, avatarXform.xformPoint(avatarHandPos));
|
|
||||||
var offsetXform = Xform.mul(palmXform.inv(), entityXform);
|
|
||||||
|
|
||||||
storeAttachPointForHotspotInSettings(this.grabbedHotspot, this.hand, offsetXform.pos, offsetXform.rot);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue