#How can I modify a WorldTransform Position from a Monobehaviour?

1 messages · Page 1 of 1 (latest)

zealous quarry
#

I've tried doing:
WorldTransform newTrans = entityManager.GetComponentData<WorldTransform>(ball);
newTrans.Position = targetPos;
newTrans.Rotation = targetRot;
entityManager.SetComponentData(ball, newTrans);
And also tried:
entityManager.SetComponentData(ball, new WorldTransform {Position = targetPos, Rotation = targetRot});

But both methods even if they don't throw errors they don't move the Ball.
Any ideas on how I should do it?

Thanks!

#

How can I modify a WorldTransform Position from a Monobehaviour?

zealous quarry
#

FOUND THE SOLUTION

#

Modify LocalTransform instead. It overrides World transform for some reason.

#

This worked on a parentless Entity, don't know how it works on an Entity with a parent.