use correct capsule dimensions in teleport.js

This commit is contained in:
Andrew Meadows 2018-11-06 12:44:14 -08:00
parent 6ecf850159
commit b38c263e60

View file

@ -358,9 +358,9 @@ Script.include("/~/system/libraries/controllers.js");
var sensorToWorldScale = MyAvatar.getSensorToWorldScale(); var sensorToWorldScale = MyAvatar.getSensorToWorldScale();
var radius = capsuleData.radius / sensorToWorldScale; var diameter = 2.0 * capsuleData.radius / sensorToWorldScale;
var height = (Vec3.distance(capsuleData.start, capsuleData.end) + (capsuleData.radius * 2.0)) / sensorToWorldScale; var height = (Vec3.distance(capsuleData.start, capsuleData.end) + diameter) / sensorToWorldScale;
var capsuleRatio = 10.0 * radius / height; var capsuleRatio = 5.0 * diameter / height;
var offset = _this.pickHeightOffset * capsuleRatio; var offset = _this.pickHeightOffset * capsuleRatio;
_this.teleportHandCollisionPick = Picks.createPick(PickType.Collision, { _this.teleportHandCollisionPick = Picks.createPick(PickType.Collision, {
@ -370,9 +370,9 @@ Script.include("/~/system/libraries/controllers.js");
shape: { shape: {
shapeType: "capsule-y", shapeType: "capsule-y",
dimensions: { dimensions: {
x: radius * 2.0, x: diameter,
y: height - (radius * 2.0), y: height,
z: radius * 2.0 z: diameter
} }
}, },
position: { x: 0, y: offset + height * 0.5, z: 0 }, position: { x: 0, y: offset + height * 0.5, z: 0 },
@ -386,9 +386,9 @@ Script.include("/~/system/libraries/controllers.js");
shape: { shape: {
shapeType: "capsule-y", shapeType: "capsule-y",
dimensions: { dimensions: {
x: radius * 2.0, x: diameter,
y: height - (radius * 2.0), y: height,
z: radius * 2.0 z: diameter
} }
}, },
position: { x: 0, y: offset + height * 0.5, z: 0 }, position: { x: 0, y: offset + height * 0.5, z: 0 },