mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
if equipped entity vanishes, reset grab state
This commit is contained in:
parent
6c9cf386a6
commit
5594f1e4e5
1 changed files with 7 additions and 0 deletions
|
@ -1446,6 +1446,13 @@ function MyController(hand) {
|
|||
this.heartBeat(this.grabbedEntity);
|
||||
|
||||
var props = Entities.getEntityProperties(this.grabbedEntity, ["localPosition", "parentID", "position"]);
|
||||
if (!props.position) {
|
||||
// server may have reset, taking our equipped entity with it. move back to "off" stte
|
||||
this.setState(STATE_RELEASE);
|
||||
this.callEntityMethodOnGrabbed("releaseGrab");
|
||||
return;
|
||||
}
|
||||
|
||||
if (props.parentID == MyAvatar.sessionUUID &&
|
||||
Vec3.length(props.localPosition) > NEAR_PICK_MAX_DISTANCE * 2.0) {
|
||||
// for whatever reason, the held/equipped entity has been pulled away. ungrab or unequip.
|
||||
|
|
Loading…
Reference in a new issue