diff --git a/src/bit-systems/object-menu.ts b/src/bit-systems/object-menu.ts index e7545c9936..b96eb82cab 100644 --- a/src/bit-systems/object-menu.ts +++ b/src/bit-systems/object-menu.ts @@ -105,7 +105,7 @@ function startRotation(world: HubsWorld, menuEid: EntityID, targetEid: EntityID) } const transformSystem = APP.scene!.systems["transform-selected-object"]; const physicsSystem = AFRAME.scenes[0].systems["hubs-systems"].physicsSystem; - physicsSystem.updateRigidBody(Rigidbody.bodyId[targetEid], { type: "kinematic" }); + physicsSystem.updateRigidBody(targetEid, { type: "kinematic" }); const rightCursorEid = anyEntityWith(world, RemoteRight)!; transformSystem.startTransform(world.eid2obj.get(targetEid)!, world.eid2obj.get(rightCursorEid)!, { mode: TRANSFORM_MODE.CURSOR @@ -137,7 +137,7 @@ function startScaling(world: HubsWorld, menuEid: EntityID, targetEid: EntityID) // TODO: Remove the dependency with AFRAME const transformSystem = (AFRAME as any).scenes[0].systems["transform-selected-object"]; const physicsSystem = AFRAME.scenes[0].systems["hubs-systems"].physicsSystem; - physicsSystem.updateRigidBody(Rigidbody.bodyId[targetEid], { type: "kinematic" }); + physicsSystem.updateRigidBody(targetEid, { type: "kinematic" }); const rightCursorEid = anyEntityWith(world, RemoteRight)!; scalingHandler = new ScalingHandler(world.eid2obj.get(targetEid), transformSystem); scalingHandler!.objectToScale = world.eid2obj.get(targetEid); diff --git a/src/components/transform-object-button.js b/src/components/transform-object-button.js index bdbcdd18fb..f9751bb167 100644 --- a/src/components/transform-object-button.js +++ b/src/components/transform-object-button.js @@ -55,7 +55,7 @@ AFRAME.registerComponent("transform-button", { if (!NAF.utils.isMine(this.targetEl) && !NAF.utils.takeOwnership(this.targetEl)) { return; } - if (this.targetEl.body) { + if (this.targetEl.hasAttribute("body-helper")) { this.targetEl.setAttribute("body-helper", AMMO_BODY_ATTRIBUTES); } this.transformSystem = this.transformSystem || AFRAME.scenes[0].systems["transform-selected-object"]; diff --git a/src/systems/hold-system.js b/src/systems/hold-system.js index 6c2c1abd37..43a44b8747 100644 --- a/src/systems/hold-system.js +++ b/src/systems/hold-system.js @@ -13,13 +13,14 @@ import { HeldHandLeft, AEntity, Networked, - Rigidbody + Rigidbody, + HoldableButton } from "../bit-components"; import { canMove } from "../utils/permissions-utils"; import { canMove as canMoveEntity } from "../utils/bit-permissions-utils"; import { isPinned } from "../bit-systems/networking"; import { takeOwnership } from "../utils/take-ownership"; -import { findAncestorWithComponents } from "../utils/bit-utils"; +import { findAncestorWithComponents, findAncestorWithComponent } from "../utils/bit-utils"; const GRAB_REMOTE_RIGHT = paths.actions.cursor.right.grab; const DROP_REMOTE_RIGHT = paths.actions.cursor.right.drop; @@ -81,8 +82,10 @@ export function isAEntityPinned(world, eid) { function grab(world, userinput, queryHovered, held, grabPath) { const hovered = queryHovered(world)[0]; + const holdablebutton = findAncestorWithComponent(world, HoldableButton, hovered); const interactable = findAncestorWithComponents(world, [Holdable, Rigidbody], hovered); const target = interactable ? interactable : hovered; + const holdtarget = holdablebutton ? holdablebutton : target; const isEntityPinned = isPinned(target) || isAEntityPinned(world, target); if ( @@ -94,8 +97,8 @@ function grab(world, userinput, queryHovered, held, grabPath) { if (hasComponent(world, Networked, target)) { takeOwnership(world, target); } - addComponent(world, held, target); - addComponent(world, Held, target); + addComponent(world, held, holdtarget); + addComponent(world, Held, holdtarget); } }