Skip to content

Commit dc8d3e9

Browse files
EntityReparentCommand: removed unneeded lines (#71)
1 parent 4563360 commit dc8d3e9

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

src/lib/commands/EntityReparentCommand.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ export class EntityReparentCommand extends Command {
7272
);
7373

7474
// Apply the new local transform to the entity
75-
entity.object3D.position.copy(newLocalPosition);
76-
entity.object3D.quaternion.copy(newLocalQuaternion);
77-
entity.object3D.scale.copy(newLocalScale);
78-
79-
// Update A-Frame attributes to reflect the changes
8075
entity.setAttribute('position', {
8176
x: newLocalPosition.x,
8277
y: newLocalPosition.y,
@@ -131,6 +126,8 @@ export class EntityReparentCommand extends Command {
131126
// Recreate entity from data to ensure clean state
132127
const recreatedEntity = objectToElement(this.entityData);
133128
recreatedEntity.id = this.entityId; // Ensure same ID
129+
// Update position/rotation/scale components relative to new parent
130+
this.updateLocalTransform(recreatedEntity, newParent);
134131

135132
// Insert at specific position
136133
if (
@@ -143,9 +140,6 @@ export class EntityReparentCommand extends Command {
143140
newParent.appendChild(recreatedEntity);
144141
}
145142

146-
// Update position/rotation/scale components relative to new parent
147-
this.updateLocalTransform(recreatedEntity, newParent);
148-
149143
// Wait for entity to be loaded before emitting events
150144
recreatedEntity.addEventListener(
151145
'loaded',
@@ -202,9 +196,6 @@ export class EntityReparentCommand extends Command {
202196
oldParent.appendChild(recreatedEntity);
203197
}
204198

205-
// Update position/rotation/scale components relative to old parent
206-
this.updateLocalTransform(recreatedEntity, oldParent);
207-
208199
// Wait for entity to be loaded before emitting events
209200
recreatedEntity.addEventListener(
210201
'loaded',

0 commit comments

Comments
 (0)