Skip to content

Commit

Permalink
Do not migrate gravity if it has the default value
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed May 3, 2024
1 parent 622af00 commit cbe82cd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions addons/io_hubs_addon/components/definitions/rigid_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@ def migrate(self, migration_type, panel_type, instance_version, host, migration_
angularFactor = Vector((angularFactor.x, angularFactor.z, angularFactor.y))
self.angularFactor = angularFactor

gravity = self.gravity.copy()
gravity = Vector((gravity.x, gravity.z, gravity.y))
self.gravity = gravity
# If the gravity property has not changed, it will take the default value so we don't swizzle
# in that case. Is there any way of checking if the property has been modified?
if self.gravity != Vector((0.0, 0.0, -9.8)):
gravity = self.gravity.copy()
gravity = Vector((gravity.x, gravity.z, gravity.y))
self.gravity = gravity

return migration_occurred

0 comments on commit cbe82cd

Please sign in to comment.