AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.41k stars 288 forks source link

#595 #597

Closed Barsonax closed 6 years ago

ilexp commented 6 years ago

Will take a look at this later, but might take a bit longer than usually for a PR of this size. This is a master commit on the Transform component after all, so we need to make sure there's absolutely no added bug potential in there.

ilexp commented 6 years ago

Simplified tests and Transform implementation a bit, made some minor code style adjustments, handled serialization and cloning for the new field and used it to optimize some more Transform methods and properties.

Still need to test some more real-world cases before merging.

Barsonax commented 6 years ago

There is still room for optimization in UpdateAbs. It currently calls MathF.GetTransformDotVec here which builds up a rotationmatrix and it also calls UpdateRotationDirAbs here which updates the rotationDir. This is a duplicate sin/cos operation I believe.

EDIT: It builds a rotationmatrix using the parents angle! Thats still a duplicate sin/cos operation though.

ilexp commented 6 years ago

There is still room for optimization in UpdateAbs. It currently calls MathF.GetTransformDotVec here which builds up a rotationmatrix and it also calls UpdateRotationDirAbs here which updates the rotationDir. This is a duplicate sin/cos operation I believe.

Nice find 👍 Will take care of it, still have the code open for testing anyway.