Skip to content

Commit cf9d825

Browse files
committed
for consistency with grabbable, always use world position
1 parent 589b54a commit cf9d825

File tree

4 files changed

+10
-28
lines changed

4 files changed

+10
-28
lines changed

dist/super-hands.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,8 +1076,7 @@ AFRAME.registerComponent('stretchable', inherit(base, {
10761076
schema: {
10771077
usePhysics: { default: 'ifavailable' },
10781078
invert: { default: false },
1079-
physicsUpdateRate: { default: 100 },
1080-
useWorldPosition: { default: false }
1079+
physicsUpdateRate: { default: 100 }
10811080
},
10821081
init: function () {
10831082
this.STRETCHED_STATE = 'stretched';
@@ -1104,13 +1103,8 @@ AFRAME.registerComponent('stretchable', inherit(base, {
11041103
return;
11051104
}
11061105
this.scale.copy(this.el.getAttribute('scale'));
1107-
if (this.data.useWorldPosition) {
1108-
this.stretchers[0].object3D.getWorldPosition(this.handPos);
1109-
this.stretchers[1].object3D.getWorldPosition(this.otherHandPos);
1110-
} else {
1111-
this.handPos.copy(this.stretchers[0].getAttribute('position'));
1112-
this.otherHandPos.copy(this.stretchers[1].getAttribute('position'));
1113-
}
1106+
this.stretchers[0].object3D.getWorldPosition(this.handPos);
1107+
this.stretchers[1].object3D.getWorldPosition(this.otherHandPos);
11141108
const currentStretch = this.handPos.distanceTo(this.otherHandPos);
11151109
let deltaStretch = 1;
11161110
if (this.previousStretch !== null && currentStretch !== 0) {

dist/super-hands.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/build.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82101,8 +82101,7 @@ AFRAME.registerComponent('stretchable', inherit(base, {
8210182101
schema: {
8210282102
usePhysics: { default: 'ifavailable' },
8210382103
invert: { default: false },
82104-
physicsUpdateRate: { default: 100 },
82105-
useWorldPosition: { default: false }
82104+
physicsUpdateRate: { default: 100 }
8210682105
},
8210782106
init: function () {
8210882107
this.STRETCHED_STATE = 'stretched';
@@ -82129,13 +82128,8 @@ AFRAME.registerComponent('stretchable', inherit(base, {
8212982128
return;
8213082129
}
8213182130
this.scale.copy(this.el.getAttribute('scale'));
82132-
if (this.data.useWorldPosition) {
82133-
this.stretchers[0].object3D.getWorldPosition(this.handPos);
82134-
this.stretchers[1].object3D.getWorldPosition(this.otherHandPos);
82135-
} else {
82136-
this.handPos.copy(this.stretchers[0].getAttribute('position'));
82137-
this.otherHandPos.copy(this.stretchers[1].getAttribute('position'));
82138-
}
82131+
this.stretchers[0].object3D.getWorldPosition(this.handPos);
82132+
this.stretchers[1].object3D.getWorldPosition(this.otherHandPos);
8213982133
const currentStretch = this.handPos.distanceTo(this.otherHandPos);
8214082134
let deltaStretch = 1;
8214182135
if (this.previousStretch !== null && currentStretch !== 0) {

reaction_components/stretchable.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ AFRAME.registerComponent('stretchable', inherit(base, {
77
schema: {
88
usePhysics: {default: 'ifavailable'},
99
invert: {default: false},
10-
physicsUpdateRate: {default: 100},
11-
useWorldPosition: {default: false}
10+
physicsUpdateRate: {default: 100}
1211
},
1312
init: function () {
1413
this.STRETCHED_STATE = 'stretched'
@@ -37,13 +36,8 @@ AFRAME.registerComponent('stretchable', inherit(base, {
3736
tick: function (time, timeDelta) {
3837
if (!this.stretched) { return }
3938
this.scale.copy(this.el.getAttribute('scale'))
40-
if (this.data.useWorldPosition) {
41-
this.stretchers[0].object3D.getWorldPosition(this.handPos)
42-
this.stretchers[1].object3D.getWorldPosition(this.otherHandPos)
43-
} else {
44-
this.handPos.copy(this.stretchers[0].getAttribute('position'))
45-
this.otherHandPos.copy(this.stretchers[1].getAttribute('position'))
46-
}
39+
this.stretchers[0].object3D.getWorldPosition(this.handPos)
40+
this.stretchers[1].object3D.getWorldPosition(this.otherHandPos)
4741
const currentStretch = this.handPos.distanceTo(this.otherHandPos)
4842
let deltaStretch = 1
4943
if (this.previousStretch !== null && currentStretch !== 0) {

0 commit comments

Comments
 (0)