Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions src/lib/commands/EntityReparentCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 (
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
Loading