Skip to content

Commit

Permalink
incorrect unit used in offset rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
HungryProton committed Jan 30, 2021
1 parent 82fe6ec commit 313e55e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="Scatter"
description="Scatter other scenes in a manually defined area"
author="HungryProton"
version="2.3.0"
version="2.3.1"
script="plugin.gd"
11 changes: 8 additions & 3 deletions src/modifiers/offset_rotation.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ func _init() -> void:


func _process_transforms(transforms, _global_seed : int) -> void:
var rotation_rad := Vector3.ZERO
rotation_rad.x = deg2rad(rotation.x)
rotation_rad.y = deg2rad(rotation.y)
rotation_rad.z = deg2rad(rotation.z)

var basis: Basis
for t in transforms.list.size():
basis = transforms.list[t].basis

basis = basis.rotated(float(local_space) * basis.x + float(!local_space) * Vector3(1, 0, 0), rotation.x)
basis = basis.rotated(float(local_space) * basis.y + float(!local_space) * Vector3(0, 1, 0), rotation.y)
basis = basis.rotated(float(local_space) * basis.z + float(!local_space) * Vector3(0, 0, 1), rotation.z)
basis = basis.rotated(float(local_space) * basis.x + float(!local_space) * Vector3(1, 0, 0), rotation_rad.x)
basis = basis.rotated(float(local_space) * basis.y + float(!local_space) * Vector3(0, 1, 0), rotation_rad.y)
basis = basis.rotated(float(local_space) * basis.z + float(!local_space) * Vector3(0, 0, 1), rotation_rad.z)

transforms.list[t].basis = basis

0 comments on commit 313e55e

Please sign in to comment.