mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-06 01:20:42 +02:00
Merge pull request #9799 from sethalves/steady-hand-lasers
Steady hand lasers
This commit is contained in:
commit
e655e442a0
4 changed files with 173 additions and 73 deletions
|
@ -23,10 +23,15 @@ Line3DOverlay::Line3DOverlay() :
|
||||||
|
|
||||||
Line3DOverlay::Line3DOverlay(const Line3DOverlay* line3DOverlay) :
|
Line3DOverlay::Line3DOverlay(const Line3DOverlay* line3DOverlay) :
|
||||||
Base3DOverlay(line3DOverlay),
|
Base3DOverlay(line3DOverlay),
|
||||||
_start(line3DOverlay->_start),
|
|
||||||
_end(line3DOverlay->_end),
|
|
||||||
_geometryCacheID(DependencyManager::get<GeometryCache>()->allocateID())
|
_geometryCacheID(DependencyManager::get<GeometryCache>()->allocateID())
|
||||||
{
|
{
|
||||||
|
setParentID(line3DOverlay->getParentID());
|
||||||
|
setParentJointIndex(line3DOverlay->getParentJointIndex());
|
||||||
|
setLocalTransform(line3DOverlay->getLocalTransform());
|
||||||
|
_direction = line3DOverlay->getDirection();
|
||||||
|
_length = line3DOverlay->getLength();
|
||||||
|
_endParentID = line3DOverlay->getEndParentID();
|
||||||
|
_endParentJointIndex = line3DOverlay->getEndJointIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
Line3DOverlay::~Line3DOverlay() {
|
Line3DOverlay::~Line3DOverlay() {
|
||||||
|
@ -37,17 +42,23 @@ Line3DOverlay::~Line3DOverlay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 Line3DOverlay::getStart() const {
|
glm::vec3 Line3DOverlay::getStart() const {
|
||||||
bool success;
|
return getPosition();
|
||||||
glm::vec3 worldStart = localToWorld(_start, getParentID(), getParentJointIndex(), success);
|
|
||||||
if (!success) {
|
|
||||||
qDebug() << "Line3DOverlay::getStart failed";
|
|
||||||
}
|
|
||||||
return worldStart;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 Line3DOverlay::getEnd() const {
|
glm::vec3 Line3DOverlay::getEnd() const {
|
||||||
bool success;
|
bool success;
|
||||||
glm::vec3 worldEnd = localToWorld(_end, getParentID(), getParentJointIndex(), success);
|
glm::vec3 localEnd;
|
||||||
|
glm::vec3 worldEnd;
|
||||||
|
|
||||||
|
if (_endParentID != QUuid()) {
|
||||||
|
glm::vec3 localOffset = _direction * _length;
|
||||||
|
bool success;
|
||||||
|
worldEnd = localToWorld(localOffset, _endParentID, _endParentJointIndex, success);
|
||||||
|
return worldEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
localEnd = getLocalEnd();
|
||||||
|
worldEnd = localToWorld(localEnd, getParentID(), getParentJointIndex(), success);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qDebug() << "Line3DOverlay::getEnd failed";
|
qDebug() << "Line3DOverlay::getEnd failed";
|
||||||
}
|
}
|
||||||
|
@ -55,27 +66,55 @@ glm::vec3 Line3DOverlay::getEnd() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Line3DOverlay::setStart(const glm::vec3& start) {
|
void Line3DOverlay::setStart(const glm::vec3& start) {
|
||||||
bool success;
|
setPosition(start);
|
||||||
_start = worldToLocal(start, getParentID(), getParentJointIndex(), success);
|
|
||||||
if (!success) {
|
|
||||||
qDebug() << "Line3DOverlay::setStart failed";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Line3DOverlay::setEnd(const glm::vec3& end) {
|
void Line3DOverlay::setEnd(const glm::vec3& end) {
|
||||||
bool success;
|
bool success;
|
||||||
_end = worldToLocal(end, getParentID(), getParentJointIndex(), success);
|
glm::vec3 localStart;
|
||||||
|
glm::vec3 localEnd;
|
||||||
|
glm::vec3 offset;
|
||||||
|
|
||||||
|
if (_endParentID != QUuid()) {
|
||||||
|
offset = worldToLocal(end, _endParentID, _endParentJointIndex, success);
|
||||||
|
} else {
|
||||||
|
localStart = getLocalStart();
|
||||||
|
localEnd = worldToLocal(end, getParentID(), getParentJointIndex(), success);
|
||||||
|
offset = localEnd - localStart;
|
||||||
|
}
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qDebug() << "Line3DOverlay::setEnd failed";
|
qDebug() << "Line3DOverlay::setEnd failed";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_length = glm::length(offset);
|
||||||
|
if (_length > 0.0f) {
|
||||||
|
_direction = glm::normalize(offset);
|
||||||
|
} else {
|
||||||
|
_direction = glm::vec3(0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Line3DOverlay::setLocalEnd(const glm::vec3& localEnd) {
|
||||||
|
glm::vec3 offset;
|
||||||
|
if (_endParentID != QUuid()) {
|
||||||
|
offset = localEnd;
|
||||||
|
} else {
|
||||||
|
glm::vec3 localStart = getLocalStart();
|
||||||
|
offset = localEnd - localStart;
|
||||||
|
}
|
||||||
|
_length = glm::length(offset);
|
||||||
|
if (_length > 0.0f) {
|
||||||
|
_direction = glm::normalize(offset);
|
||||||
|
} else {
|
||||||
|
_direction = glm::vec3(0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AABox Line3DOverlay::getBounds() const {
|
AABox Line3DOverlay::getBounds() const {
|
||||||
auto extents = Extents{};
|
auto extents = Extents{};
|
||||||
extents.addPoint(_start);
|
extents.addPoint(getStart());
|
||||||
extents.addPoint(_end);
|
extents.addPoint(getEnd());
|
||||||
extents.transform(getTransform());
|
|
||||||
|
|
||||||
return AABox(extents);
|
return AABox(extents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,18 +129,20 @@ void Line3DOverlay::render(RenderArgs* args) {
|
||||||
glm::vec4 colorv4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
glm::vec4 colorv4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
||||||
auto batch = args->_batch;
|
auto batch = args->_batch;
|
||||||
if (batch) {
|
if (batch) {
|
||||||
batch->setModelTransform(getTransform());
|
batch->setModelTransform(Transform());
|
||||||
|
glm::vec3 start = getStart();
|
||||||
|
glm::vec3 end = getEnd();
|
||||||
|
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
if (getIsDashedLine()) {
|
if (getIsDashedLine()) {
|
||||||
// TODO: add support for color to renderDashedLine()
|
// TODO: add support for color to renderDashedLine()
|
||||||
geometryCache->bindSimpleProgram(*batch, false, false, false, true, true);
|
geometryCache->bindSimpleProgram(*batch, false, false, false, true, true);
|
||||||
geometryCache->renderDashedLine(*batch, _start, _end, colorv4, _geometryCacheID);
|
geometryCache->renderDashedLine(*batch, start, end, colorv4, _geometryCacheID);
|
||||||
} else if (_glow > 0.0f) {
|
} else if (_glow > 0.0f) {
|
||||||
geometryCache->renderGlowLine(*batch, _start, _end, colorv4, _glow, _glowWidth, _geometryCacheID);
|
geometryCache->renderGlowLine(*batch, start, end, colorv4, _glow, _glowWidth, _geometryCacheID);
|
||||||
} else {
|
} else {
|
||||||
geometryCache->bindSimpleProgram(*batch, false, false, false, true, true);
|
geometryCache->bindSimpleProgram(*batch, false, false, false, true, true);
|
||||||
geometryCache->renderLine(*batch, _start, _end, colorv4, _geometryCacheID);
|
geometryCache->renderLine(*batch, start, end, colorv4, _geometryCacheID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +157,10 @@ const render::ShapeKey Line3DOverlay::getShapeKey() {
|
||||||
|
|
||||||
void Line3DOverlay::setProperties(const QVariantMap& originalProperties) {
|
void Line3DOverlay::setProperties(const QVariantMap& originalProperties) {
|
||||||
QVariantMap properties = originalProperties;
|
QVariantMap properties = originalProperties;
|
||||||
|
glm::vec3 newStart(0.0f);
|
||||||
|
bool newStartSet { false };
|
||||||
|
glm::vec3 newEnd(0.0f);
|
||||||
|
bool newEndSet { false };
|
||||||
|
|
||||||
auto start = properties["start"];
|
auto start = properties["start"];
|
||||||
// if "start" property was not there, check to see if they included aliases: startPoint
|
// if "start" property was not there, check to see if they included aliases: startPoint
|
||||||
|
@ -123,30 +168,57 @@ void Line3DOverlay::setProperties(const QVariantMap& originalProperties) {
|
||||||
start = properties["startPoint"];
|
start = properties["startPoint"];
|
||||||
}
|
}
|
||||||
if (start.isValid()) {
|
if (start.isValid()) {
|
||||||
setStart(vec3FromVariant(start));
|
newStart = vec3FromVariant(start);
|
||||||
|
newStartSet = true;
|
||||||
}
|
}
|
||||||
properties.remove("start"); // so that Base3DOverlay doesn't respond to it
|
properties.remove("start"); // so that Base3DOverlay doesn't respond to it
|
||||||
|
|
||||||
auto localStart = properties["localStart"];
|
|
||||||
if (localStart.isValid()) {
|
|
||||||
_start = vec3FromVariant(localStart);
|
|
||||||
}
|
|
||||||
properties.remove("localStart"); // so that Base3DOverlay doesn't respond to it
|
|
||||||
|
|
||||||
auto end = properties["end"];
|
auto end = properties["end"];
|
||||||
// if "end" property was not there, check to see if they included aliases: endPoint
|
// if "end" property was not there, check to see if they included aliases: endPoint
|
||||||
if (!end.isValid()) {
|
if (!end.isValid()) {
|
||||||
end = properties["endPoint"];
|
end = properties["endPoint"];
|
||||||
}
|
}
|
||||||
if (end.isValid()) {
|
if (end.isValid()) {
|
||||||
setEnd(vec3FromVariant(end));
|
newEnd = vec3FromVariant(end);
|
||||||
|
newEndSet = true;
|
||||||
|
}
|
||||||
|
properties.remove("end"); // so that Base3DOverlay doesn't respond to it
|
||||||
|
|
||||||
|
auto length = properties["length"];
|
||||||
|
if (length.isValid()) {
|
||||||
|
_length = length.toFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
Base3DOverlay::setProperties(properties);
|
||||||
|
|
||||||
|
auto endParentIDProp = properties["endParentID"];
|
||||||
|
if (endParentIDProp.isValid()) {
|
||||||
|
_endParentID = QUuid(endParentIDProp.toString());
|
||||||
|
}
|
||||||
|
auto endParentJointIndexProp = properties["endParentJointIndex"];
|
||||||
|
if (endParentJointIndexProp.isValid()) {
|
||||||
|
_endParentJointIndex = endParentJointIndexProp.toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto localStart = properties["localStart"];
|
||||||
|
if (localStart.isValid()) {
|
||||||
|
glm::vec3 tmpLocalEnd = getLocalEnd();
|
||||||
|
setLocalStart(vec3FromVariant(localStart));
|
||||||
|
setLocalEnd(tmpLocalEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto localEnd = properties["localEnd"];
|
auto localEnd = properties["localEnd"];
|
||||||
if (localEnd.isValid()) {
|
if (localEnd.isValid()) {
|
||||||
_end = vec3FromVariant(localEnd);
|
setLocalEnd(vec3FromVariant(localEnd));
|
||||||
|
}
|
||||||
|
|
||||||
|
// these are saved until after Base3DOverlay::setProperties so parenting infomation can be set, first
|
||||||
|
if (newStartSet) {
|
||||||
|
setStart(newStart);
|
||||||
|
}
|
||||||
|
if (newEndSet) {
|
||||||
|
setEnd(newEnd);
|
||||||
}
|
}
|
||||||
properties.remove("localEnd"); // so that Base3DOverlay doesn't respond to it
|
|
||||||
|
|
||||||
auto glow = properties["glow"];
|
auto glow = properties["glow"];
|
||||||
if (glow.isValid()) {
|
if (glow.isValid()) {
|
||||||
|
@ -161,7 +233,6 @@ void Line3DOverlay::setProperties(const QVariantMap& originalProperties) {
|
||||||
setGlow(glowWidth.toFloat());
|
setGlow(glowWidth.toFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
Base3DOverlay::setProperties(properties);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant Line3DOverlay::getProperty(const QString& property) {
|
QVariant Line3DOverlay::getProperty(const QString& property) {
|
||||||
|
@ -171,6 +242,15 @@ QVariant Line3DOverlay::getProperty(const QString& property) {
|
||||||
if (property == "end" || property == "endPoint" || property == "p2") {
|
if (property == "end" || property == "endPoint" || property == "p2") {
|
||||||
return vec3toVariant(getEnd());
|
return vec3toVariant(getEnd());
|
||||||
}
|
}
|
||||||
|
if (property == "localStart") {
|
||||||
|
return vec3toVariant(getLocalStart());
|
||||||
|
}
|
||||||
|
if (property == "localEnd") {
|
||||||
|
return vec3toVariant(getLocalEnd());
|
||||||
|
}
|
||||||
|
if (property == "length") {
|
||||||
|
return QVariant(getLength());
|
||||||
|
}
|
||||||
|
|
||||||
return Base3DOverlay::getProperty(property);
|
return Base3DOverlay::getProperty(property);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,9 @@ public:
|
||||||
void setStart(const glm::vec3& start);
|
void setStart(const glm::vec3& start);
|
||||||
void setEnd(const glm::vec3& end);
|
void setEnd(const glm::vec3& end);
|
||||||
|
|
||||||
|
void setLocalStart(const glm::vec3& localStart) { setLocalPosition(localStart); }
|
||||||
|
void setLocalEnd(const glm::vec3& localEnd);
|
||||||
|
|
||||||
void setGlow(const float& glow) { _glow = glow; }
|
void setGlow(const float& glow) { _glow = glow; }
|
||||||
void setGlowWidth(const float& glowWidth) { _glowWidth = glowWidth; }
|
void setGlowWidth(const float& glowWidth) { _glowWidth = glowWidth; }
|
||||||
|
|
||||||
|
@ -47,13 +50,26 @@ public:
|
||||||
|
|
||||||
virtual void locationChanged(bool tellPhysics = true) override;
|
virtual void locationChanged(bool tellPhysics = true) override;
|
||||||
|
|
||||||
protected:
|
glm::vec3 getDirection() const { return _direction; }
|
||||||
glm::vec3 _start;
|
float getLength() const { return _length; }
|
||||||
glm::vec3 _end;
|
glm::vec3 getLocalStart() const { return getLocalPosition(); }
|
||||||
|
glm::vec3 getLocalEnd() const { return getLocalStart() + _direction * _length; }
|
||||||
|
QUuid getEndParentID() const { return _endParentID; }
|
||||||
|
quint16 getEndJointIndex() const { return _endParentJointIndex; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QUuid _endParentID;
|
||||||
|
quint16 _endParentJointIndex { INVALID_JOINT_INDEX };
|
||||||
|
|
||||||
|
// _direction and _length are in the parent's frame. If _endParentID is set, they are
|
||||||
|
// relative to that. Otherwise, they are relative to the local-start-position (which is the
|
||||||
|
// same as localPosition)
|
||||||
|
glm::vec3 _direction; // in parent frame
|
||||||
|
float _length { 1.0 }; // in parent frame
|
||||||
|
|
||||||
float _glow { 0.0 };
|
float _glow { 0.0 };
|
||||||
float _glowWidth { 0.0 };
|
float _glowWidth { 0.0 };
|
||||||
int _geometryCacheID;
|
int _geometryCacheID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // hifi_Line3DOverlay_h
|
#endif // hifi_Line3DOverlay_h
|
||||||
|
|
|
@ -160,13 +160,14 @@ RenderDeferredTask::RenderDeferredTask(RenderFetchCullSortTask::Output items) {
|
||||||
addJob<DrawOverlay3D>("DrawOverlay3DOpaque", overlayOpaquesInputs, true);
|
addJob<DrawOverlay3D>("DrawOverlay3DOpaque", overlayOpaquesInputs, true);
|
||||||
addJob<DrawOverlay3D>("DrawOverlay3DTransparent", overlayTransparentsInputs, false);
|
addJob<DrawOverlay3D>("DrawOverlay3DTransparent", overlayTransparentsInputs, false);
|
||||||
|
|
||||||
|
|
||||||
// Debugging stages
|
// Debugging stages
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// Bounds do not draw on stencil buffer, so they must come last
|
// Bounds do not draw on stencil buffer, so they must come last
|
||||||
addJob<DrawBounds>("DrawMetaBounds", metas);
|
addJob<DrawBounds>("DrawMetaBounds", metas);
|
||||||
|
addJob<DrawBounds>("DrawOverlayOpaqueBounds", overlayOpaques);
|
||||||
|
addJob<DrawBounds>("DrawOverlayTransparentBounds", overlayTransparents);
|
||||||
|
|
||||||
// Debugging Deferred buffer job
|
// Debugging Deferred buffer job
|
||||||
const auto debugFramebuffers = render::Varying(DebugDeferredBuffer::Inputs(deferredFramebuffer, linearDepthTarget, surfaceGeometryFramebuffer, ambientOcclusionFramebuffer));
|
const auto debugFramebuffers = render::Varying(DebugDeferredBuffer::Inputs(deferredFramebuffer, linearDepthTarget, surfaceGeometryFramebuffer, ambientOcclusionFramebuffer));
|
||||||
|
|
|
@ -761,6 +761,10 @@ function MyController(hand) {
|
||||||
this.stylus = null;
|
this.stylus = null;
|
||||||
this.homeButtonTouched = false;
|
this.homeButtonTouched = false;
|
||||||
|
|
||||||
|
this.controllerJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ?
|
||||||
|
"_CONTROLLER_RIGHTHAND" :
|
||||||
|
"_CONTROLLER_LEFTHAND");
|
||||||
|
|
||||||
// Until there is some reliable way to keep track of a "stack" of parentIDs, we'll have problems
|
// Until there is some reliable way to keep track of a "stack" of parentIDs, we'll have problems
|
||||||
// when more than one avatar does parenting grabs on things. This script tries to work
|
// when more than one avatar does parenting grabs on things. This script tries to work
|
||||||
// around this with two associative arrays: previousParentID and previousParentJointIndex. If
|
// around this with two associative arrays: previousParentID and previousParentJointIndex. If
|
||||||
|
@ -812,9 +816,6 @@ function MyController(hand) {
|
||||||
|
|
||||||
// for visualizations
|
// for visualizations
|
||||||
this.overlayLine = null;
|
this.overlayLine = null;
|
||||||
|
|
||||||
// for lights
|
|
||||||
this.overlayLine = null;
|
|
||||||
this.searchSphere = null;
|
this.searchSphere = null;
|
||||||
|
|
||||||
this.waitForTriggerRelease = false;
|
this.waitForTriggerRelease = false;
|
||||||
|
@ -941,9 +942,7 @@ function MyController(hand) {
|
||||||
ignoreRayIntersection: true,
|
ignoreRayIntersection: true,
|
||||||
drawInFront: false,
|
drawInFront: false,
|
||||||
parentID: AVATAR_SELF_ID,
|
parentID: AVATAR_SELF_ID,
|
||||||
parentJointIndex: MyAvatar.getJointIndex(this.hand === RIGHT_HAND ?
|
parentJointIndex: this.controllerJointIndex
|
||||||
"_CONTROLLER_RIGHTHAND" :
|
|
||||||
"_CONTROLLER_LEFTHAND")
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1028,32 +1027,38 @@ function MyController(hand) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.overlayLineOn = function(closePoint, farPoint, color) {
|
this.overlayLineOn = function(closePoint, farPoint, color, farParentID) {
|
||||||
if (this.overlayLine === null) {
|
if (this.overlayLine === null) {
|
||||||
var lineProperties = {
|
var lineProperties = {
|
||||||
name: "line",
|
name: "line",
|
||||||
glow: 1.0,
|
glow: 1.0,
|
||||||
start: closePoint,
|
|
||||||
end: farPoint,
|
|
||||||
color: color,
|
|
||||||
ignoreRayIntersection: true, // always ignore this
|
|
||||||
drawInFront: true, // Even when burried inside of something, show it.
|
|
||||||
visible: true,
|
|
||||||
alpha: 1
|
|
||||||
};
|
|
||||||
this.overlayLine = Overlays.addOverlay("line3d", lineProperties);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Overlays.editOverlay(this.overlayLine, {
|
|
||||||
lineWidth: 5,
|
lineWidth: 5,
|
||||||
start: closePoint,
|
start: closePoint,
|
||||||
end: farPoint,
|
end: farPoint,
|
||||||
color: color,
|
color: color,
|
||||||
visible: true,
|
|
||||||
ignoreRayIntersection: true, // always ignore this
|
ignoreRayIntersection: true, // always ignore this
|
||||||
drawInFront: true, // Even when burried inside of something, show it.
|
drawInFront: true, // Even when burried inside of something, show it.
|
||||||
alpha: 1
|
visible: true,
|
||||||
|
alpha: 1,
|
||||||
|
parentID: AVATAR_SELF_ID,
|
||||||
|
parentJointIndex: this.controllerJointIndex,
|
||||||
|
endParentID: farParentID
|
||||||
|
};
|
||||||
|
this.overlayLine = Overlays.addOverlay("line3d", lineProperties);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (farParentID && farParentID != NULL_UUID) {
|
||||||
|
Overlays.editOverlay(this.overlayLine, {
|
||||||
|
color: color,
|
||||||
|
endParentID: farParentID
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
Overlays.editOverlay(this.overlayLine, {
|
||||||
|
length: Vec3.distance(farPoint, closePoint),
|
||||||
|
color: color,
|
||||||
|
endParentID: farParentID
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2245,7 +2250,10 @@ function MyController(hand) {
|
||||||
|
|
||||||
var rayPickInfo = this.calcRayPickInfo(this.hand);
|
var rayPickInfo = this.calcRayPickInfo(this.hand);
|
||||||
|
|
||||||
this.overlayLineOn(rayPickInfo.searchRay.origin, Vec3.subtract(grabbedProperties.position, this.offsetPosition), COLORS_GRAB_DISTANCE_HOLD);
|
this.overlayLineOn(rayPickInfo.searchRay.origin,
|
||||||
|
Vec3.subtract(grabbedProperties.position, this.offsetPosition),
|
||||||
|
COLORS_GRAB_DISTANCE_HOLD,
|
||||||
|
this.grabbedThingID);
|
||||||
|
|
||||||
var distanceToObject = Vec3.length(Vec3.subtract(MyAvatar.position, this.currentObjectPosition));
|
var distanceToObject = Vec3.length(Vec3.subtract(MyAvatar.position, this.currentObjectPosition));
|
||||||
var success = Entities.updateAction(this.grabbedThingID, this.actionID, {
|
var success = Entities.updateAction(this.grabbedThingID, this.actionID, {
|
||||||
|
@ -2437,9 +2445,7 @@ function MyController(hand) {
|
||||||
this.actionID = null;
|
this.actionID = null;
|
||||||
var handJointIndex;
|
var handJointIndex;
|
||||||
if (this.ignoreIK) {
|
if (this.ignoreIK) {
|
||||||
handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ?
|
handJointIndex = this.controllerJointIndex;
|
||||||
"_CONTROLLER_RIGHTHAND" :
|
|
||||||
"_CONTROLLER_LEFTHAND");
|
|
||||||
} else {
|
} else {
|
||||||
handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ? "RightHand" : "LeftHand");
|
handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ? "RightHand" : "LeftHand");
|
||||||
}
|
}
|
||||||
|
@ -3246,9 +3252,7 @@ function MyController(hand) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var controllerJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ?
|
var controllerJointIndex = this.controllerJointIndex;
|
||||||
"_CONTROLLER_RIGHTHAND" :
|
|
||||||
"_CONTROLLER_LEFTHAND");
|
|
||||||
if (props.parentJointIndex == controllerJointIndex) {
|
if (props.parentJointIndex == controllerJointIndex) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3274,9 +3278,7 @@ function MyController(hand) {
|
||||||
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, handJointIndex));
|
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, handJointIndex));
|
||||||
|
|
||||||
// find children of faux controller joint
|
// find children of faux controller joint
|
||||||
var controllerJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ?
|
var controllerJointIndex = this.controllerJointIndex;
|
||||||
"_CONTROLLER_RIGHTHAND" :
|
|
||||||
"_CONTROLLER_LEFTHAND");
|
|
||||||
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerJointIndex));
|
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerJointIndex));
|
||||||
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, controllerJointIndex));
|
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, controllerJointIndex));
|
||||||
|
|
||||||
|
@ -3288,7 +3290,8 @@ function MyController(hand) {
|
||||||
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, controllerCRJointIndex));
|
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, controllerCRJointIndex));
|
||||||
|
|
||||||
children.forEach(function(childID) {
|
children.forEach(function(childID) {
|
||||||
if (childID !== _this.stylus) {
|
if (childID !== _this.stylus &&
|
||||||
|
childID !== _this.overlayLine) {
|
||||||
// we appear to be holding something and this script isn't in a state that would be holding something.
|
// we appear to be holding something and this script isn't in a state that would be holding something.
|
||||||
// unhook it. if we previously took note of this entity's parent, put it back where it was. This
|
// unhook it. if we previously took note of this entity's parent, put it back where it was. This
|
||||||
// works around some problems that happen when more than one hand or avatar is passing something around.
|
// works around some problems that happen when more than one hand or avatar is passing something around.
|
||||||
|
|
Loading…
Reference in a new issue