Bläddra i källkod

tools: fix rotate tool when object has non-default scale

Daniele Bartolini 6 år sedan
förälder
incheckning
40589b4f1a
1 ändrade filer med 4 tillägg och 4 borttagningar
  1. 4 4
      samples/core/editors/level_editor/level_editor.lua

+ 4 - 4
samples/core/editors/level_editor/level_editor.lua

@@ -208,7 +208,7 @@ function Selection:world_poses()
 	local objs = self:objects()
 	local poses = {}
 	for k, v in pairs(objs) do
-		poses[#poses + 1] = Matrix4x4Box(v:local_pose())
+		poses[#poses + 1] = Matrix4x4Box(v:world_pose())
 	end
 	return poses
 end
@@ -302,7 +302,9 @@ function UnitBox:world_scale()
 end
 
 function UnitBox:world_pose()
-	return SceneGraph.instances(self._sg, self._unit_id) and SceneGraph.world_pose(self._sg, self._unit_id) or Matrix4x4.identity()
+	local position = self:world_position()
+	local rotation = self:local_rotation() -- FIXME: this sould compute world rotation from local rotations
+	return Matrix4x4.from_quaternion_translation(rotation, position)
 end
 
 function UnitBox:set_local_position(pos)
@@ -400,8 +402,6 @@ function SoundObject:init(world, id, name, range, volume, loop)
 	self._unit_id = World.spawn_unit(world, "core/units/sound")
 	self._sg = World.scene_graph(world)
 	self._selected = false
-
-	local pw = World.physics_world(world)
 end
 
 function SoundObject:id()