Hazel icon indicating copy to clipboard operation
Hazel copied to clipboard

Added transform copying

Open aryan-sinhala349 opened this issue 2 years ago • 0 comments

Describe the issue (if no issue has been made)

During runtime or simulation, editing the TransformComponent of an entity with a Rigidbody2DComponent does not update neither the TransformComponent nor the b2Body. This means that the transform can not be updated during simulation to either test a physics object at a new location and can not be updated during runtime for gameplay reasons.

PR impact (Make sure to add closing keywords)

Partially fixes the copying issue, as now translation and rotation are copied. Scale isn't copied yet, though that can be added at a later time.

Impact Issue/PR
Issues this solves None or #number(s)
Other PRs this solves None or #number(s)

Proposed fix (Make sure you've read on how to contribute to Hazel)

Before having Box2D step and update physics, copying the translation and z rotation from the TransformComponent into the b2Body and check if the b2Body should be awoken.

Additional context

As of right now, this only affects the position and the rotation of the b2Body, and does not change the attached collider's size. In the future, I may implement this.

  • [ ] Add scaling for BoxCollider2D
  • [ ] Add scaling for CircleCollider2D

aryan-sinhala349 avatar Sep 06 '22 13:09 aryan-sinhala349