Skip to content

Commit

Permalink
fix: sdk7 tween transform position update (#6037)
Browse files Browse the repository at this point in the history
* fix: sdk7 tween transform position update
* improved test
  • Loading branch information
pravusjif authored Jan 4, 2024
1 parent cac5485 commit 2da9460
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ private void UpdateTransformComponent(IParcelScene scene, IDCLEntity entity, Tra
var transformComponent = transformComponentPool.Get();
var transformComponentModel = transformComponent.WrappedComponent.Model;
Vector3 currentWorldOffset = worldOffset.Get();
var newPosition = entityTransform.localPosition;
transformComponentModel.position = UtilsScene.GlobalToScenePosition(ref scene.sceneData.basePosition, ref newPosition, ref currentWorldOffset);
var newUnityGlobalPosition = entityTransform.position;
transformComponentModel.position = UtilsScene.GlobalToScenePosition(ref scene.sceneData.basePosition, ref newUnityGlobalPosition, ref currentWorldOffset);
transformComponentModel.rotation = entityTransform.localRotation;
transformComponentModel.scale = entityTransform.localScale;
transformComponentModel.parentId = entity.parentId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public void SetUp()
{ 666, new ComponentWriter(outgoingMessages) }
};

scene = testUtils.CreateScene(666);
// We use a non-0,0 scene to have realistic transform update checks
scene = testUtils.CreateScene(666, new Vector2Int(30, 30), new[] { new Vector2Int(30, 30) });
entity = scene.CreateEntity(1000);

var system = new ECSTweenSystem(
Expand Down Expand Up @@ -117,6 +118,7 @@ public void UpdateTransformComponentCorrectly()

tweener.Goto(duration * currentTime);
systemUpdate();

outgoingMessages.Put_Called<ECSTransform>(
entity.entityId,
ComponentID.TRANSFORM,
Expand Down

0 comments on commit 2da9460

Please sign in to comment.