diff --git a/src/lib/commands/EntityReparentCommand.js b/src/lib/commands/EntityReparentCommand.js index 143d007b1..797f32e9a 100644 --- a/src/lib/commands/EntityReparentCommand.js +++ b/src/lib/commands/EntityReparentCommand.js @@ -72,11 +72,6 @@ export class EntityReparentCommand extends Command { ); // Apply the new local transform to the entity - entity.object3D.position.copy(newLocalPosition); - entity.object3D.quaternion.copy(newLocalQuaternion); - entity.object3D.scale.copy(newLocalScale); - - // Update A-Frame attributes to reflect the changes entity.setAttribute('position', { x: newLocalPosition.x, y: newLocalPosition.y, @@ -131,6 +126,8 @@ export class EntityReparentCommand extends Command { // Recreate entity from data to ensure clean state const recreatedEntity = objectToElement(this.entityData); recreatedEntity.id = this.entityId; // Ensure same ID + // Update position/rotation/scale components relative to new parent + this.updateLocalTransform(recreatedEntity, newParent); // Insert at specific position if ( @@ -143,9 +140,6 @@ export class EntityReparentCommand extends Command { newParent.appendChild(recreatedEntity); } - // Update position/rotation/scale components relative to new parent - this.updateLocalTransform(recreatedEntity, newParent); - // Wait for entity to be loaded before emitting events recreatedEntity.addEventListener( 'loaded', @@ -202,9 +196,6 @@ export class EntityReparentCommand extends Command { oldParent.appendChild(recreatedEntity); } - // Update position/rotation/scale components relative to old parent - this.updateLocalTransform(recreatedEntity, oldParent); - // Wait for entity to be loaded before emitting events recreatedEntity.addEventListener( 'loaded',