2
0
Эх сурвалжийг харах

Node transform space refactoring. Translate(), Rotate() and LookAt() functions take a transform space (local, parent or world). Translate() has a behavior change: default space is local, as that is most often used in eg. camera movement, and is consistent with the default for rotations (the earlier fixedAxis = false was same as local space). The redundant TranslateRelative() function is removed. Add RotateAround() function, which allows rotating around a pivot in either local, parent or world space. Closes #295.

Lasse Öörni 11 жил өмнө
parent
commit
67d603d8e5
61 өөрчлөгдсөн 396 нэмэгдсэн , 324 устгасан
  1. 5 6
      Bin/Data/LuaScripts/04_StaticScene.lua
  2. 4 4
      Bin/Data/LuaScripts/05_AnimatingScene.lua
  3. 5 5
      Bin/Data/LuaScripts/06_SkeletalAnimation.lua
  4. 5 5
      Bin/Data/LuaScripts/07_Billboards.lua
  5. 4 4
      Bin/Data/LuaScripts/08_Decals.lua
  6. 4 4
      Bin/Data/LuaScripts/09_MultipleViewports.lua
  7. 4 4
      Bin/Data/LuaScripts/10_RenderToTexture.lua
  8. 4 4
      Bin/Data/LuaScripts/11_Physics.lua
  9. 4 4
      Bin/Data/LuaScripts/12_PhysicsStressTest.lua
  10. 4 4
      Bin/Data/LuaScripts/13_Ragdolls.lua
  11. 5 5
      Bin/Data/LuaScripts/15_Navigation.lua
  12. 0 1
      Bin/Data/LuaScripts/18_CharacterDemo.lua
  13. 4 4
      Bin/Data/LuaScripts/20_HugeObjectCount.lua
  14. 5 5
      Bin/Data/LuaScripts/23_Water.lua
  15. 4 6
      Bin/Data/LuaScripts/24_Urho2DSprite.lua
  16. 4 6
      Bin/Data/LuaScripts/27_Urho2DPhysics.lua
  17. 4 6
      Bin/Data/LuaScripts/28_Urho2DPhysicsRope.lua
  18. 6 7
      Bin/Data/Scripts/04_StaticScene.as
  19. 5 5
      Bin/Data/Scripts/05_AnimatingScene.as
  20. 5 5
      Bin/Data/Scripts/06_SkeletalAnimation.as
  21. 5 5
      Bin/Data/Scripts/07_Billboards.as
  22. 4 4
      Bin/Data/Scripts/08_Decals.as
  23. 4 4
      Bin/Data/Scripts/09_MultipleViewports.as
  24. 4 4
      Bin/Data/Scripts/10_RenderToTexture.as
  25. 4 4
      Bin/Data/Scripts/11_Physics.as
  26. 4 4
      Bin/Data/Scripts/12_PhysicsStressTest.as
  27. 4 4
      Bin/Data/Scripts/13_Ragdolls.as
  28. 5 5
      Bin/Data/Scripts/15_Navigation.as
  29. 4 4
      Bin/Data/Scripts/20_HugeObjectCount.as
  30. 4 4
      Bin/Data/Scripts/23_Water.as
  31. 4 6
      Bin/Data/Scripts/24_Urho2DSprite.as
  32. 4 6
      Bin/Data/Scripts/27_Urho2DPhysics.as
  33. 4 6
      Bin/Data/Scripts/28_Urho2DPhysicsRope.as
  34. 1 1
      Bin/Data/Scripts/Editor/EditorSpawn.as
  35. 12 19
      Bin/Data/Scripts/Editor/EditorView.as
  36. 4 4
      Bin/Data/Scripts/NinjaSnowWar.as
  37. 2 2
      Source/Engine/Graphics/View.cpp
  38. 31 23
      Source/Engine/LuaScript/pkgs/Scene/Node.pkg
  39. 100 20
      Source/Engine/Scene/Node.cpp
  40. 19 11
      Source/Engine/Scene/Node.h
  41. 7 7
      Source/Engine/Script/APITemplates.h
  42. 5 0
      Source/Engine/Script/SceneAPI.cpp
  43. 5 6
      Source/Samples/04_StaticScene/StaticScene.cpp
  44. 4 4
      Source/Samples/05_AnimatingScene/AnimatingScene.cpp
  45. 1 1
      Source/Samples/06_SkeletalAnimation/Mover.cpp
  46. 4 4
      Source/Samples/06_SkeletalAnimation/SkeletalAnimation.cpp
  47. 5 5
      Source/Samples/07_Billboards/Billboards.cpp
  48. 4 4
      Source/Samples/08_Decals/Decals.cpp
  49. 4 4
      Source/Samples/09_MultipleViewports/MultipleViewports.cpp
  50. 4 4
      Source/Samples/10_RenderToTexture/RenderToTexture.cpp
  51. 4 4
      Source/Samples/11_Physics/Physics.cpp
  52. 4 4
      Source/Samples/12_PhysicsStressTest/PhysicsStressTest.cpp
  53. 4 4
      Source/Samples/13_Ragdolls/Ragdolls.cpp
  54. 5 5
      Source/Samples/15_Navigation/Navigation.cpp
  55. 4 4
      Source/Samples/20_HugeObjectCount/HugeObjectCount.cpp
  56. 4 4
      Source/Samples/21_AngelScriptIntegration/AngelScriptIntegration.cpp
  57. 4 4
      Source/Samples/22_LuaIntegration/LuaIntegration.cpp
  58. 4 4
      Source/Samples/23_Water/Water.cpp
  59. 4 6
      Source/Samples/24_Urho2DSprite/Urho2DSprite.cpp
  60. 4 6
      Source/Samples/27_Urho2DPhysics/Urho2DPhysics.cpp
  61. 4 6
      Source/Samples/28_Urho2DPhysicsRope/Urho2DPhysicsRope.cpp

+ 5 - 6
Bin/Data/LuaScripts/04_StaticScene.lua

@@ -121,19 +121,18 @@ function MoveCamera(timeStep)
     cameraNode.rotation = Quaternion(pitch, yaw, 0.0)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    -- Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    -- multiply the desired direction with the node's orientation quaternion, and use just Translate()
+    -- Use the Translate() function (default local space) to move relative to the node's orientation.
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 end
 

+ 4 - 4
Bin/Data/LuaScripts/05_AnimatingScene.lua

@@ -122,16 +122,16 @@ function MoveCamera(timeStep)
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     local delta = MOVE_SPEED * timeStep
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelativeXYZ(0.0, 0.0, delta)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelativeXYZ(0.0, 0.0, -delta)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelativeXYZ(-delta, 0.0, 0.0)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelativeXYZ(delta, 0.0, 0.0)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 end
 

+ 5 - 5
Bin/Data/LuaScripts/06_SkeletalAnimation.lua

@@ -157,16 +157,16 @@ function MoveCamera(timeStep)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     -- Toggle debug geometry with space
     if input:GetKeyPress(KEY_SPACE) then
@@ -208,7 +208,7 @@ end
 
 function Mover:Update(timeStep)
     local node = self:GetNode()
-    node:TranslateRelative(Vector3(0.0, 0.0, 1.0) * self.moveSpeed * timeStep)
+    node:Translate(Vector3(0.0, 0.0, 1.0) * self.moveSpeed * timeStep)
     
     -- If in risk of going outside the plane, rotate the model right
     local pos = node.position

+ 5 - 5
Bin/Data/LuaScripts/07_Billboards.lua

@@ -214,16 +214,16 @@ function MoveCamera(timeStep)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 
     -- Toggle debug geometry with space
@@ -238,7 +238,7 @@ function AnimateScene(timeStep)
 
     -- Rotate the lights around the world Y-axis
     for i, v in ipairs(lightNodes) do
-        v:Rotate(Quaternion(0.0, LIGHT_ROTATION_SPEED * timeStep, 0.0), true)
+        v:Rotate(Quaternion(0.0, LIGHT_ROTATION_SPEED * timeStep, 0.0), TS_WORLD)
     end
 
     -- Rotate the individual billboards within the billboard sets, then recommit to make the changes visible

+ 4 - 4
Bin/Data/LuaScripts/08_Decals.lua

@@ -173,16 +173,16 @@ function MoveCamera(timeStep)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 
     -- Toggle debug geometry with space

+ 4 - 4
Bin/Data/LuaScripts/09_MultipleViewports.lua

@@ -188,16 +188,16 @@ function MoveCamera(timeStep)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 
     -- Toggle post processing effects on the front viewport. Note that the rear viewport is unaffected

+ 4 - 4
Bin/Data/LuaScripts/10_RenderToTexture.lua

@@ -192,16 +192,16 @@ function MoveCamera(timeStep)
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     local delta = MOVE_SPEED * timeStep
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelativeXYZ(0.0, 0.0, delta)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelativeXYZ(0.0, 0.0, -delta)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelativeXYZ(-delta, 0.0, 0.0)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelativeXYZ(delta, 0.0, 0.0)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 end
 

+ 4 - 4
Bin/Data/LuaScripts/11_Physics.lua

@@ -171,16 +171,16 @@ function MoveCamera(timeStep)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     
     -- "Shoot" a physics object with left mousebutton

+ 4 - 4
Bin/Data/LuaScripts/12_PhysicsStressTest.lua

@@ -187,16 +187,16 @@ function MoveCamera(timeStep)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 
     -- "Shoot" a physics object with left mousebutton

+ 4 - 4
Bin/Data/LuaScripts/13_Ragdolls.lua

@@ -172,16 +172,16 @@ function MoveCamera(timeStep)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 
     -- "Shoot" a physics object with left mousebutton

+ 5 - 5
Bin/Data/LuaScripts/15_Navigation.lua

@@ -189,16 +189,16 @@ function MoveCamera(timeStep)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     -- Set destination or teleport with left mouse button
     if input:GetMouseButtonPress(MOUSEB_LEFT) then
@@ -320,7 +320,7 @@ function FollowPath(timeStep)
         end
 
         jackNode:LookAt(nextWaypoint, Vector3(0.0, 1.0, 0.0))
-        jackNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * move)
+        jackNode:Translate(Vector3(0.0, 0.0, 1.0) * move)
 
         -- Remove waypoint if reached it
         if (jackNode.position - nextWaypoint):Length() < 0.1 then

+ 0 - 1
Bin/Data/LuaScripts/18_CharacterDemo.lua

@@ -264,7 +264,6 @@ function HandleUpdate(eventType, eventData)
 end
 
 function HandlePostUpdate(eventType, eventData)
-
     if characterNode == nil then
         return
     end

+ 4 - 4
Bin/Data/LuaScripts/20_HugeObjectCount.lua

@@ -158,16 +158,16 @@ function MoveCamera(timeStep)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 end
 

+ 5 - 5
Bin/Data/LuaScripts/23_Water.lua

@@ -197,18 +197,18 @@ function MoveCamera(timeStep)
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
-    
+
     -- In case resolution has changed, adjust the reflection camera aspect ratio
     local reflectionCamera = reflectionCameraNode:GetComponent("Camera")
     reflectionCamera.aspectRatio = graphics.width / graphics.height

+ 4 - 6
Bin/Data/LuaScripts/24_Urho2DSprite.lua

@@ -143,19 +143,17 @@ function MoveCamera(timeStep)
     local MOVE_SPEED = 4.0
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    -- Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    -- multiply the desired direction with the node's orientation quaternion, and use just Translate()
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3.UP * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 1.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3.DOWN * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, -1.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3.LEFT * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3.RIGHT * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 
     if input:GetKeyDown(KEY_PAGEUP) then

+ 4 - 6
Bin/Data/LuaScripts/27_Urho2DPhysics.lua

@@ -134,19 +134,17 @@ function MoveCamera(timeStep)
     local MOVE_SPEED = 4.0
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    -- Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    -- multiply the desired direction with the node's orientation quaternion, and use just Translate()
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3.UP * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 1.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3.DOWN * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, -1.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3.LEFT * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3.RIGHT * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 
     if input:GetKeyDown(KEY_PAGEUP) then

+ 4 - 6
Bin/Data/LuaScripts/28_Urho2DPhysicsRope.lua

@@ -133,19 +133,17 @@ function MoveCamera(timeStep)
     local MOVE_SPEED = 4.0
 
     -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    -- Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    -- multiply the desired direction with the node's orientation quaternion, and use just Translate()
     if input:GetKeyDown(KEY_W) then
-        cameraNode:TranslateRelative(Vector3.UP * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, 1.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_S) then
-        cameraNode:TranslateRelative(Vector3.DOWN * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(0.0, -1.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_A) then
-        cameraNode:TranslateRelative(Vector3.LEFT * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
     if input:GetKeyDown(KEY_D) then
-        cameraNode:TranslateRelative(Vector3.RIGHT * MOVE_SPEED * timeStep)
+        cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep)
     end
 
     if input:GetKeyDown(KEY_PAGEUP) then

+ 6 - 7
Bin/Data/Scripts/04_StaticScene.as

@@ -8,6 +8,7 @@
 
 Scene@ scene_;
 Node@ cameraNode;
+Node@ boxNode;
 float yaw = 0.0f;
 float pitch = 0.0f;
 
@@ -126,16 +127,15 @@ void MoveCamera(float timeStep)
     cameraNode.rotation = Quaternion(pitch, yaw, 0.0f);
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    // Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    // multiply the desired direction with the node's orientation quaternion, and use just Translate()
+    // Use the Translate() function (default local space) to move relative to the node's orientation.
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 }
 
 void SubscribeToEvents()
@@ -152,4 +152,3 @@ void HandleUpdate(StringHash eventType, VariantMap& eventData)
     // Move the camera, scale movement with time step
     MoveCamera(timeStep);
 }
-

+ 5 - 5
Bin/Data/Scripts/05_AnimatingScene.as

@@ -54,7 +54,7 @@ void CreateScene()
     for (uint i = 0; i < NUM_OBJECTS; ++i)
     {
         Node@ boxNode = scene_.CreateChild("Box");
-        boxNode.position = Vector3(Random(200.0f) - 100.0f, Random(200.0f) - 100.0f, Random(200.0f) - 100.0f);
+        boxNode.position = Vector3(Random(20.0f) - 10.0f, Random(20.0f) - 10.0f, Random(20.0f) - 10.0f);
         // Orient using random pitch, yaw and roll Euler angles
         boxNode.rotation = Quaternion(Random(360.0f), Random(360.0f), Random(360.0f));
         StaticModel@ boxObject = boxNode.CreateComponent("StaticModel");
@@ -129,13 +129,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 }
 
 void SubscribeToEvents()

+ 5 - 5
Bin/Data/Scripts/06_SkeletalAnimation.as

@@ -165,13 +165,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     // Toggle debug geometry with space
     if (input.keyPress[KEY_SPACE])
@@ -212,7 +212,7 @@ class Mover : ScriptObject
 
     void Update(float timeStep)
     {
-        node.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * moveSpeed * timeStep);
+        node.Translate(Vector3(0.0f, 0.0f, 1.0f) * moveSpeed * timeStep);
 
         // If in risk of going outside the plane, rotate the model right
         Vector3 pos = node.position;

+ 5 - 5
Bin/Data/Scripts/07_Billboards.as

@@ -220,13 +220,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     // Toggle debug geometry with space
     if (input.keyPress[KEY_SPACE])
@@ -244,7 +244,7 @@ void AnimateScene(float timeStep)
 
     // Rotate the lights around the world Y-axis
     for (uint i = 0; i < lightNodes.length; ++i)
-        lightNodes[i].Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), true);
+        lightNodes[i].Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), TS_WORLD);
 
     // Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
     for (uint i = 0; i < billboardNodes.length; ++i)

+ 4 - 4
Bin/Data/Scripts/08_Decals.as

@@ -180,13 +180,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     // Toggle debug geometry with space
     if (input.keyPress[KEY_SPACE])

+ 4 - 4
Bin/Data/Scripts/09_MultipleViewports.as

@@ -194,13 +194,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     // Toggle post processing effects on the front viewport. Note that the rear viewport is unaffected
     RenderPath@ effectRenderPath = renderer.viewports[0].renderPath;

+ 4 - 4
Bin/Data/Scripts/10_RenderToTexture.as

@@ -205,13 +205,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 }
 
 void SubscribeToEvents()

+ 4 - 4
Bin/Data/Scripts/11_Physics.as

@@ -183,13 +183,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     // "Shoot" a physics object with left mousebutton
     if (input.mouseButtonPress[MOUSEB_LEFT])

+ 4 - 4
Bin/Data/Scripts/12_PhysicsStressTest.as

@@ -190,13 +190,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     // "Shoot" a physics object with left mousebutton
     if (input.mouseButtonPress[MOUSEB_LEFT])

+ 4 - 4
Bin/Data/Scripts/13_Ragdolls.as

@@ -181,13 +181,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     // "Shoot" a physics object with left mousebutton
     if (input.mouseButtonPress[MOUSEB_LEFT])

+ 5 - 5
Bin/Data/Scripts/15_Navigation.as

@@ -197,13 +197,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     // Set destination or teleport with left mouse button
     if (input.mouseButtonPress[MOUSEB_LEFT])
@@ -327,7 +327,7 @@ void FollowPath(float timeStep)
             move = distance;
         
         jackNode.LookAt(nextWaypoint, Vector3(0.0f, 1.0f, 0.0f));
-        jackNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * move);
+        jackNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * move);
 
         // Remove waypoint if reached it
         if ((jackNode.position - nextWaypoint).length < 0.1)

+ 4 - 4
Bin/Data/Scripts/20_HugeObjectCount.as

@@ -173,13 +173,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 }
 
 void AnimateObjects(float timeStep)

+ 4 - 4
Bin/Data/Scripts/23_Water.as

@@ -204,13 +204,13 @@ void MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, 1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 0.0f, -1.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     // In case resolution has changed, adjust the reflection camera aspect ratio
     Camera@ reflectionCamera = reflectionCameraNode.GetComponent("Camera");

+ 4 - 6
Bin/Data/Scripts/24_Urho2DSprite.as

@@ -128,16 +128,14 @@ void MoveCamera(float timeStep)
     const float MOVE_SPEED = 4.0f;
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    // Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    // multiply the desired direction with the node's orientation quaternion, and use just Translate()
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 1.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 1.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, -1.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, -1.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     if (input.keyDown[KEY_PAGEUP])
     {

+ 4 - 6
Bin/Data/Scripts/27_Urho2DPhysics.as

@@ -151,16 +151,14 @@ void MoveCamera(float timeStep)
     const float MOVE_SPEED = 4.0f;
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    // Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    // multiply the desired direction with the node's orientation quaternion, and use just Translate()
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 1.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 1.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, -1.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, -1.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     if (input.keyDown[KEY_PAGEUP])
     {

+ 4 - 6
Bin/Data/Scripts/28_Urho2DPhysicsRope.as

@@ -143,16 +143,14 @@ void MoveCamera(float timeStep)
     const float MOVE_SPEED = 4.0f;
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    // Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    // multiply the desired direction with the node's orientation quaternion, and use just Translate()
     if (input.keyDown['W'])
-        cameraNode.TranslateRelative(Vector3(0.0f, 1.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, 1.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['S'])
-        cameraNode.TranslateRelative(Vector3(0.0f, -1.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(0.0f, -1.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['A'])
-        cameraNode.TranslateRelative(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(-1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
     if (input.keyDown['D'])
-        cameraNode.TranslateRelative(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
+        cameraNode.Translate(Vector3(1.0f, 0.0f, 0.0f) * MOVE_SPEED * timeStep);
 
     if (input.keyDown[KEY_PAGEUP])
     {

+ 1 - 1
Bin/Data/Scripts/Editor/EditorSpawn.as

@@ -231,7 +231,7 @@ void PlaceObject(Vector3 spawnPosition, Vector3 normal)
     
     spawnedObject.scale=spawnedObject.scale*Random(randomScaleMin, randomScaleMax);
     spawnedObject.Rotate(Quaternion(Random(-randomRotation.x,randomRotation.x),
-    Random(-randomRotation.y,randomRotation.y),Random(-randomRotation.z,randomRotation.z)),false);
+    Random(-randomRotation.y,randomRotation.y),Random(-randomRotation.z,randomRotation.z)));
     CreateNodeAction action;
     action.Define(spawnedObject);
     SaveEditAction(action);

+ 12 - 19
Bin/Data/Scripts/Editor/EditorView.as

@@ -1099,48 +1099,41 @@ void UpdateView(float timeStep)
 
         if (input.keyDown['W'] || input.keyDown[KEY_UP])
         {
-            cameraNode.TranslateRelative(Vector3(0, 0, cameraBaseSpeed) * timeStep * speedMultiplier);
+            cameraNode.Translate(Vector3(0, 0, cameraBaseSpeed) * timeStep * speedMultiplier);
             FadeUI();
         }
         if (input.keyDown['S'] || input.keyDown[KEY_DOWN])
         {
-            cameraNode.TranslateRelative(Vector3(0, 0, -cameraBaseSpeed) * timeStep * speedMultiplier);
+            cameraNode.Translate(Vector3(0, 0, -cameraBaseSpeed) * timeStep * speedMultiplier);
             FadeUI();
         }
         if (input.keyDown['A'] || input.keyDown[KEY_LEFT])
         {
-            cameraNode.TranslateRelative(Vector3(-cameraBaseSpeed, 0, 0) * timeStep * speedMultiplier);
+            cameraNode.Translate(Vector3(-cameraBaseSpeed, 0, 0) * timeStep * speedMultiplier);
             FadeUI();
         }
         if (input.keyDown['D'] || input.keyDown[KEY_RIGHT])
         {
-            cameraNode.TranslateRelative(Vector3(cameraBaseSpeed, 0, 0) * timeStep * speedMultiplier);
+            cameraNode.Translate(Vector3(cameraBaseSpeed, 0, 0) * timeStep * speedMultiplier);
             FadeUI();
         }
-        if (input.keyDown[KEY_PAGEUP])
-        {
-            cameraNode.Translate(Vector3(0, cameraBaseSpeed, 0) * timeStep * speedMultiplier);
-            FadeUI();
-        }
-        if (input.keyDown[KEY_PAGEDOWN])
+        if (input.keyDown['E'] || input.keyDown[KEY_PAGEUP])
         {
-            cameraNode.Translate(Vector3(0, -cameraBaseSpeed, 0) * timeStep * speedMultiplier);
+            cameraNode.Translate(Vector3(0, cameraBaseSpeed, 0) * timeStep * speedMultiplier, TS_WORLD);
             FadeUI();
         }
-        if (input.keyDown['E'])
+        if (input.keyDown['Q'] || input.keyDown[KEY_PAGEDOWN])
         {
-            cameraNode.Translate(Vector3(0, cameraBaseSpeed, 0) * timeStep * speedMultiplier);
-            FadeUI();
-        }
-        if (input.keyDown['Q'])
-        {
-            cameraNode.Translate(Vector3(0, -cameraBaseSpeed, 0) * timeStep * speedMultiplier);
+            cameraNode.Translate(Vector3(0, -cameraBaseSpeed, 0) * timeStep * speedMultiplier, TS_WORLD);
             FadeUI();
         }
         if (input.mouseMoveWheel != 0 && ui.GetElementAt(ui.cursor.position) is null)
         {
             if (mouseWheelCameraPosition)
-                cameraNode.TranslateRelative(Vector3(0, 0, -cameraBaseSpeed) * -input.mouseMoveWheel*20 * timeStep * speedMultiplier);
+            {
+                cameraNode.Translate(Vector3(0, 0, -cameraBaseSpeed) * -input.mouseMoveWheel*20 * timeStep *
+                    speedMultiplier);
+            }
             else
             {
                 float zoom = camera.zoom + -input.mouseMoveWheel *.1 * speedMultiplier;

+ 4 - 4
Bin/Data/Scripts/NinjaSnowWar.as

@@ -1117,13 +1117,13 @@ void UpdateFreelookCamera()
         speedMultiplier = 0.1;
 
     if (input.keyDown['W'])
-        gameCameraNode.TranslateRelative(Vector3(0, 0, 10) * timeStep * speedMultiplier);
+        gameCameraNode.Translate(Vector3(0, 0, 10) * timeStep * speedMultiplier);
     if (input.keyDown['S'])
-        gameCameraNode.TranslateRelative(Vector3(0, 0, -10) * timeStep * speedMultiplier);
+        gameCameraNode.Translate(Vector3(0, 0, -10) * timeStep * speedMultiplier);
     if (input.keyDown['A'])
-        gameCameraNode.TranslateRelative(Vector3(-10, 0, 0) * timeStep * speedMultiplier);
+        gameCameraNode.Translate(Vector3(-10, 0, 0) * timeStep * speedMultiplier);
     if (input.keyDown['D'])
-        gameCameraNode.TranslateRelative(Vector3(10, 0, 0) * timeStep * speedMultiplier);
+        gameCameraNode.Translate(Vector3(10, 0, 0) * timeStep * speedMultiplier);
 
     playerControls.yaw += mouseSensitivity * input.mouseMoveX;
     playerControls.pitch += mouseSensitivity * input.mouseMoveY;

+ 2 - 2
Source/Engine/Graphics/View.cpp

@@ -2518,7 +2518,7 @@ void View::QuantizeDirLightShadowCamera(Camera* shadowCamera, Light* light, cons
     // Center shadow camera to the view space bounding box
     Quaternion rot(shadowCameraNode->GetWorldRotation());
     Vector3 adjust(center.x_, center.y_, 0.0f);
-    shadowCameraNode->Translate(rot * adjust);
+    shadowCameraNode->Translate(rot * adjust, TS_WORLD);
     
     // If the shadow map viewport is known, snap to whole texels
     if (shadowMapWidth > 0.0f)
@@ -2528,7 +2528,7 @@ void View::QuantizeDirLightShadowCamera(Camera* shadowCamera, Light* light, cons
         float invActualSize = 1.0f / (shadowMapWidth - 2.0f);
         Vector2 texelSize(viewSize.x_ * invActualSize, viewSize.y_ * invActualSize);
         Vector3 snap(-fmodf(viewPos.x_, texelSize.x_), -fmodf(viewPos.y_, texelSize.y_), 0.0f);
-        shadowCameraNode->Translate(rot * snap);
+        shadowCameraNode->Translate(rot * snap, TS_WORLD);
     }
 }
 

+ 31 - 23
Source/Engine/LuaScript/pkgs/Scene/Node.pkg

@@ -2,12 +2,20 @@ $#include "File.h"
 $#include "Node.h"
 $#include "LuaScriptInstance.h"
 
+
 enum CreateMode
 {
     REPLICATED = 0,
     LOCAL = 1
 };
 
+enum TransformSpace
+{
+    TS_LOCAL = 0,
+    TS_PARENT,
+    TS_WORLD
+};
+
 class Node : public Serializable
 {
     Node();
@@ -45,26 +53,26 @@ class Node : public Serializable
     void SetWorldScale(float scale);
     void SetWorldScale(const Vector3& scale);
     tolua_outside void NodeSetWorldScaleXYZ @ SetWorldScaleXYZ(float x, float y, float z);
-    
+
     void SetWorldTransform(const Vector3& position, const Quaternion& rotation);
     void SetWorldTransform(const Vector3& position, const Quaternion& rotation, float scale);
     void SetWorldTransform(const Vector3& position, const Quaternion& rotation, const Vector3& scale);
     
-    void Translate(const Vector3& delta);
-    tolua_outside void NodeTranslateXYZ @ TranslateXYZ(float x, float y, float z);
-    
-    void TranslateRelative(const Vector3& delta);
-    tolua_outside void NodeTranslateRelativeXYZ @ TranslateRelativeXYZ(float x, float y, float z);
-    
-    void Rotate(const Quaternion& delta, bool fixedAxis = false);
-    tolua_outside void NodeRotateXYZ @ RotateXYZ(float x, float y, float z, bool fixedAxis = false);
-    
-    void Pitch(float angle, bool fixedAxis = false);
-    void Yaw(float angle, bool fixedAxis = false);
-    void Roll(float angle, bool fixedAxis = false);
+    void Translate(const Vector3& delta, TransformSpace space = TS_LOCAL);
+    tolua_outside void NodeTranslateXYZ @ TranslateXYZ(float x, float y, float z, TransformSpace space = TS_LOCAL);
+
+    void Rotate(const Quaternion& delta, TransformSpace space = TS_LOCAL);
+    tolua_outside void NodeRotateXYZ @ RotateXYZ(float x, float y, float z, TransformSpace space = TS_LOCAL);
+
+    void RotateAround(const Vector3& point, const Quaternion& delta, TransformSpace space = TS_LOCAL);
+    tolua_outside void NodeRotateAroundXYZ @ RotateAroundXYZ(float pX, float pY, float pZ, float dX, float dY, float dZ, TransformSpace space = TS_LOCAL);
+
+    void Pitch(float angle, TransformSpace space = TS_LOCAL);
+    void Yaw(float angle, TransformSpace space = TS_LOCAL);
+    void Roll(float angle, TransformSpace space = TS_LOCAL);
     
-    bool LookAt(const Vector3& target, const Vector3& upAxis = Vector3::UP);
-    tolua_outside bool NodeLookAtXYZ @ LookAtXYZ(float x, float y, float z, float upX = 0.0f, float upY = 1.0f, float upZ = 0.0f);
+    bool LookAt(const Vector3& target, const Vector3& upAxis = Vector3::UP, TransformSpace space = TS_WORLD);
+    tolua_outside bool NodeLookAtXYZ @ LookAtXYZ(float x, float y, float z, float upX = 0.0f, float upY = 1.0f, float upZ = 0.0f, TransformSpace space = TS_WORLD);
 
     void Scale(float scale);
     void Scale(const Vector3& scale);
@@ -271,24 +279,24 @@ static void NodeSetWorldScaleXYZ(Node* node, float x, float y, float z)
     node->SetWorldScale(Vector3(x, y, z));
 }
 
-static void NodeTranslateXYZ(Node* node, float x, float y, float z)
+static void NodeTranslateXYZ(Node* node, float x, float y, float z, TransformSpace space = TS_LOCAL)
 {
-    node->Translate(Vector3(x, y, z));
+    node->Translate(Vector3(x, y, z), space);
 }
 
-static void NodeTranslateRelativeXYZ(Node* node, float x, float y, float z)
+static void NodeRotateXYZ(Node* node, float x, float y, float z, TransformSpace space = TS_LOCAL)
 {
-    node->TranslateRelative(Vector3(x, y, z));
+    node->Rotate(Quaternion(x, y, z), space);
 }
 
-static void NodeRotateXYZ(Node* node, float x, float y, float z, bool fixedAxis = false)
+static void NodeRotateAroundXYZ(Node* node, float pX, float pY, float pZ, float rX, float rY, float rZ, TransformSpace space = TS_LOCAL)
 {
-    node->Rotate(Quaternion(x, y, z), fixedAxis);
+    node->RotateAround(Vector3(pX, pY, pZ), Quaternion(rX, rY, rZ), space);
 }
 
-static bool NodeLookAtXYZ(Node* node, float x, float y, float z, float upX = 0.0f, float upY = 1.0f, float upZ = 0.0f)
+static bool NodeLookAtXYZ(Node* node, float x, float y, float z, float upX = 0.0f, float upY = 1.0f, float upZ = 0.0f, TransformSpace space = TS_WORLD)
 {
-    return node->LookAt(Vector3(x, y, z), Vector3(upX, upY, upZ));
+    return node->LookAt(Vector3(x, y, z), Vector3(upX, upY, upZ), space);
 }
 
 static void NodeScaleXYZ(Node* node, float x, float y, float z)

+ 100 - 20
Source/Engine/Scene/Node.cpp

@@ -356,60 +356,140 @@ void Node::SetWorldTransform(const Vector3& position, const Quaternion& rotation
     SetWorldScale(scale);
 }
 
-void Node::Translate(const Vector3& delta)
+void Node::Translate(const Vector3& delta, TransformSpace space)
 {
-    position_ += delta;
+    switch (space)
+    {
+    case TS_LOCAL:
+        position_ += rotation_ * delta;
+        break;
+        
+    case TS_PARENT:
+        position_ += delta;
+        break;
+        
+    case TS_WORLD:
+        position_ += (parent_ == scene_ || !parent_) ? delta : parent_->GetWorldTransform().Inverse() * Vector4(delta, 0.0f);
+        break;
+    }
+    
     MarkDirty();
-
+    
     MarkNetworkUpdate();
 }
 
-void Node::TranslateRelative(const Vector3& delta)
+void Node::Rotate(const Quaternion& delta, TransformSpace space)
 {
-    position_ += rotation_ * delta;
-    MarkDirty();
+    switch (space)
+    {
+    case TS_LOCAL:
+        rotation_ = (rotation_ * delta).Normalized();
+        break;
+        
+    case TS_PARENT:
+        rotation_ = (delta * rotation_).Normalized();
+        break;
+        
+    case TS_WORLD:
+        if (parent_ == scene_ || !parent_)
+            rotation_ = (delta * rotation_).Normalized();
+        else
+        {
+            Quaternion worldRotation = GetWorldRotation();
+            rotation_ = rotation_ * worldRotation.Inverse() * delta * worldRotation;
+        }
+        break;
+    }
 
+    MarkDirty();
+    
     MarkNetworkUpdate();
 }
 
-void Node::Rotate(const Quaternion& delta, bool fixedAxis)
+void Node::RotateAround(const Vector3& point, const Quaternion& delta, TransformSpace space)
 {
-    if (!fixedAxis)
+    Vector3 parentSpacePoint;
+    Quaternion oldRotation = rotation_;
+    
+    switch (space)
+    {
+    case TS_LOCAL:
+        parentSpacePoint = GetTransform() * point;
         rotation_ = (rotation_ * delta).Normalized();
-    else
+        break;
+        
+    case TS_PARENT:
+        parentSpacePoint = point;
         rotation_ = (delta * rotation_).Normalized();
-    MarkDirty();
+        break;
+        
+    case TS_WORLD:
+        if (parent_ == scene_ || !parent_)
+        {
+            parentSpacePoint = point;
+            rotation_ = (delta * rotation_).Normalized();
+        }
+        else
+        {
+            parentSpacePoint = parent_->GetWorldTransform().Inverse() * point;
+            Quaternion worldRotation = GetWorldRotation();
+            rotation_ = rotation_ * worldRotation.Inverse() * delta * worldRotation;
+        }
+        break;
+    }
+    
+    Vector3 oldRelativePos = oldRotation.Inverse() * (position_ - parentSpacePoint);
+    position_ = rotation_ * oldRelativePos + parentSpacePoint;
 
+    MarkDirty();
+    
     MarkNetworkUpdate();
 }
 
-void Node::Yaw(float angle, bool fixedAxis)
+void Node::Yaw(float angle, TransformSpace space)
 {
-    Rotate(Quaternion(angle, Vector3::UP), fixedAxis);
+    Rotate(Quaternion(angle, Vector3::UP), space);
 }
 
-void Node::Pitch(float angle, bool fixedAxis)
+void Node::Pitch(float angle, TransformSpace space)
 {
-    Rotate(Quaternion(angle, Vector3::RIGHT), fixedAxis);
+    Rotate(Quaternion(angle, Vector3::RIGHT), space);
 }
 
-void Node::Roll(float angle, bool fixedAxis)
+void Node::Roll(float angle, TransformSpace space)
 {
-    Rotate(Quaternion(angle, Vector3::FORWARD), fixedAxis);
+    Rotate(Quaternion(angle, Vector3::FORWARD), space);
 }
 
-bool Node::LookAt(const Vector3& target, const Vector3& up)
+bool Node::LookAt(const Vector3& target, const Vector3& up, TransformSpace space)
 {
+    Vector3 worldSpaceTarget;
+    
+    switch (space)
+    {
+    case TS_LOCAL:
+        worldSpaceTarget = GetWorldTransform() * target;
+        break;
+        
+    case TS_PARENT:
+        worldSpaceTarget = (parent_ == scene_ || !parent_) ? target : parent_->GetWorldTransform() * target;
+        break;
+        
+    case TS_WORLD:
+        worldSpaceTarget = target;
+        break;
+    }
+    
     Vector3 lookDir = target - GetWorldPosition();
     // Check if target is very close, in that case can not reliably calculate lookat direction
     if (lookDir.Equals(Vector3::ZERO))
         return false;
-    Quaternion rotation;
+    Quaternion newRotation;
     // Do nothing if setting look rotation failed
-    if (!rotation.FromLookRotation(lookDir, up))
+    if (!newRotation.FromLookRotation(lookDir, up))
         return false;
     
-    SetRotation((parent_ == scene_ || !parent_) ? rotation : parent_->GetWorldRotation().Inverse() * rotation);
+    SetWorldRotation(newRotation);
     return true;
 }
 

+ 19 - 11
Source/Engine/Scene/Node.h

@@ -43,6 +43,14 @@ enum CreateMode
     LOCAL = 1
 };
 
+/// Transform space for translations and rotations.
+enum TransformSpace
+{
+    TS_LOCAL = 0,
+    TS_PARENT,
+    TS_WORLD
+};
+
 /// %Scene node that may contain components and child nodes.
 class URHO3D_API Node : public Serializable
 {
@@ -112,20 +120,20 @@ public:
     void SetWorldTransform(const Vector3& position, const Quaternion& rotation, float scale);
     /// Set both position, rotation and scale in world space as an atomic opration.
     void SetWorldTransform(const Vector3& position, const Quaternion& rotation, const Vector3& scale);
-    /// Move the scene node in parent space, which is the same as world space if the scene node is on the root level.
-    void Translate(const Vector3& delta);
-    /// Move the scene node in parent space relative to its current rotation.
-    void TranslateRelative(const Vector3& delta);
-    /// Rotate the scene node in parent space either relative to its current rotation axes, or a fixed axis.
-    void Rotate(const Quaternion& delta, bool fixedAxis = false);
+    /// Move the scene node in the chosen transform space.
+    void Translate(const Vector3& delta, TransformSpace space = TS_LOCAL);
+    /// Rotate the scene node in the chosen transform space.
+    void Rotate(const Quaternion& delta, TransformSpace space = TS_LOCAL);
+    /// Rotate around a point in the chosen transform space.
+    void RotateAround(const Vector3& point, const Quaternion& delta, TransformSpace space = TS_LOCAL);
     /// Rotate around the X axis.
-    void Pitch(float angle, bool fixedAxis = false);
+    void Pitch(float angle, TransformSpace space = TS_LOCAL);
     /// Rotate around the Y axis.
-    void Yaw(float angle, bool fixedAxis = false);
+    void Yaw(float angle, TransformSpace space = TS_LOCAL);
     /// Rotate around the Z axis.
-    void Roll(float angle, bool fixedAxis = false);
-    /// Look at a target world position. Return true if successful, or false if resulted in an illegal rotation, in which case the current rotation remains.
-    bool LookAt(const Vector3& target, const Vector3& up = Vector3::UP);
+    void Roll(float angle, TransformSpace space = TS_LOCAL);
+    /// Look at a target position in the chosen transform space. Note that the up vector is always specified in world space. Return true if successful, or false if resulted in an illegal rotation, in which case the current rotation remains.
+    bool LookAt(const Vector3& target, const Vector3& up = Vector3::UP, TransformSpace space = TS_WORLD);
     /// Modify scale in parent space uniformly.
     void Scale(float scale);
     /// Modify scale in parent space.

+ 7 - 7
Source/Engine/Script/APITemplates.h

@@ -598,13 +598,13 @@ template <class T> void RegisterNode(asIScriptEngine* engine, const char* classN
     engine->RegisterObjectMethod(className, "void SetWorldTransform(const Vector3&in, const Quaternion&in)", asMETHODPR(T, SetWorldTransform, (const Vector3&, const Quaternion&), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void SetWorldTransform(const Vector3&in, const Quaternion&in, float)", asMETHODPR(T, SetWorldTransform, (const Vector3&, const Quaternion&, float), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void SetWorldTransform(const Vector3&in, const Quaternion&in, const Vector3&in)", asMETHODPR(T, SetWorldTransform, (const Vector3&, const Quaternion&, const Vector3&), void), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void Translate(const Vector3&in)", asMETHOD(T, Translate), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void TranslateRelative(const Vector3&in)", asMETHOD(T, TranslateRelative), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void Rotate(const Quaternion&in, bool fixedAxis = false)", asMETHOD(T, Rotate), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void Pitch(float, bool fixedAxis = false)", asMETHOD(T, Pitch), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void Yaw(float, bool fixedAxis = false)", asMETHOD(T, Yaw), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void Roll(float, bool fixedAxis = false)", asMETHOD(T, Roll), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "bool LookAt(const Vector3&in, const Vector3&in up = Vector3(0, 1, 0))", asMETHOD(T, LookAt), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void Translate(const Vector3&in, TransformSpace space = TS_LOCAL)", asMETHOD(T, Translate), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void Rotate(const Quaternion&in, TransformSpace space = TS_LOCAL)", asMETHOD(T, Rotate), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void RotateAround(const Vector3&in, const Quaternion&in, TransformSpace space = TS_LOCAL)", asMETHOD(T, RotateAround), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void Pitch(float, TransformSpace space = TS_LOCAL)", asMETHOD(T, Pitch), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void Yaw(float, TransformSpace space = TS_LOCAL)", asMETHOD(T, Yaw), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void Roll(float, TransformSpace space = TS_LOCAL)", asMETHOD(T, Roll), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "bool LookAt(const Vector3&in, const Vector3&in up = Vector3(0, 1, 0), TransformSpace space = TS_WORLD)", asMETHOD(T, LookAt), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void Scale(float)", asMETHODPR(T, Scale, (float), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void Scale(const Vector3&in)", asMETHODPR(T, Scale, (const Vector3&), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "Node@+ CreateChild(const String&in name = String(), CreateMode mode = REPLICATED, uint id = 0)", asMETHODPR(T, CreateChild, (const String&, CreateMode, unsigned), Node*), asCALL_THISCALL);

+ 5 - 0
Source/Engine/Script/SceneAPI.cpp

@@ -60,6 +60,11 @@ static void RegisterNode(asIScriptEngine* engine)
     engine->RegisterEnumValue("CreateMode", "REPLICATED", REPLICATED);
     engine->RegisterEnumValue("CreateMode", "LOCAL", LOCAL);
 
+    engine->RegisterEnum("TransformSpace");
+    engine->RegisterEnumValue("TransformSpace", "TS_LOCAL", TS_LOCAL);
+    engine->RegisterEnumValue("TransformSpace", "TS_PARENT", TS_PARENT);
+    engine->RegisterEnumValue("TransformSpace", "TS_WORLD", TS_WORLD);
+    
     // Register Component first. At this point Node is not yet registered, so can not register GetNode for Component
     RegisterComponent<Component>(engine, "Component", false, false);
     RegisterNode<Node>(engine, "Node");

+ 5 - 6
Source/Samples/04_StaticScene/StaticScene.cpp

@@ -173,16 +173,15 @@ void StaticScene::MoveCamera(float timeStep)
     cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    // Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    // multiply the desired direction with the node's orientation quaternion, and use just Translate()
+    // Use the Translate() function (default local space) to move relative to the node's orientation.
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
 }
 
 void StaticScene::SubscribeToEvents()

+ 4 - 4
Source/Samples/05_AnimatingScene/AnimatingScene.cpp

@@ -181,13 +181,13 @@ void AnimatingScene::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
 }
 
 void AnimatingScene::HandleUpdate(StringHash eventType, VariantMap& eventData)

+ 1 - 1
Source/Samples/06_SkeletalAnimation/Mover.cpp

@@ -46,7 +46,7 @@ void Mover::SetParameters(float moveSpeed, float rotationSpeed, const BoundingBo
 
 void Mover::Update(float timeStep)
 {
-    node_->TranslateRelative(Vector3::FORWARD * moveSpeed_ * timeStep);
+    node_->Translate(Vector3::FORWARD * moveSpeed_ * timeStep);
     
     // If in risk of going outside the plane, rotate the model right
     Vector3 pos = node_->GetPosition();

+ 4 - 4
Source/Samples/06_SkeletalAnimation/SkeletalAnimation.cpp

@@ -221,13 +221,13 @@ void SkeletalAnimation::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     // Toggle debug geometry with space
     if (input->GetKeyPress(KEY_SPACE))

+ 5 - 5
Source/Samples/07_Billboards/Billboards.cpp

@@ -272,13 +272,13 @@ void Billboards::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     // Toggle debug geometry with space
     if (input->GetKeyPress(KEY_SPACE))
@@ -298,7 +298,7 @@ void Billboards::AnimateScene(float timeStep)
     
     // Rotate the lights around the world Y-axis
     for (unsigned i = 0; i < lightNodes.Size(); ++i)
-        lightNodes[i]->Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), true);
+        lightNodes[i]->Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), TS_WORLD);
     
     // Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
     for (unsigned i = 0; i < billboardNodes.Size(); ++i)

+ 4 - 4
Source/Samples/08_Decals/Decals.cpp

@@ -234,13 +234,13 @@ void Decals::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     // Toggle debug geometry with space
     if (input->GetKeyPress(KEY_SPACE))

+ 4 - 4
Source/Samples/09_MultipleViewports/MultipleViewports.cpp

@@ -249,13 +249,13 @@ void MultipleViewports::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     // Toggle post processing effects on the front viewport. Note that the rear viewport is unaffected
     RenderPath* effectRenderPath = GetSubsystem<Renderer>()->GetViewport(0)->GetRenderPath();

+ 4 - 4
Source/Samples/10_RenderToTexture/RenderToTexture.cpp

@@ -258,13 +258,13 @@ void RenderToTexture::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
 }
 
 void RenderToTexture::SubscribeToEvents()

+ 4 - 4
Source/Samples/11_Physics/Physics.cpp

@@ -239,13 +239,13 @@ void Physics::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     // "Shoot" a physics object with left mousebutton
     if (input->GetMouseButtonPress(MOUSEB_LEFT))

+ 4 - 4
Source/Samples/12_PhysicsStressTest/PhysicsStressTest.cpp

@@ -244,13 +244,13 @@ void PhysicsStressTest::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     // "Shoot" a physics object with left mousebutton
     if (input->GetMouseButtonPress(MOUSEB_LEFT))

+ 4 - 4
Source/Samples/13_Ragdolls/Ragdolls.cpp

@@ -230,13 +230,13 @@ void Ragdolls::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     // "Shoot" a physics object with left mousebutton
     if (input->GetMouseButtonPress(MOUSEB_LEFT))

+ 5 - 5
Source/Samples/15_Navigation/Navigation.cpp

@@ -248,13 +248,13 @@ void Navigation::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     // Set destination or teleport with left mouse button
     if (input->GetMouseButtonPress(MOUSEB_LEFT))
@@ -383,7 +383,7 @@ void Navigation::FollowPath(float timeStep)
             move = distance;
         
         jackNode_->LookAt(nextWaypoint, Vector3::UP);
-        jackNode_->TranslateRelative(Vector3::FORWARD * move);
+        jackNode_->Translate(Vector3::FORWARD * move);
 
         // Remove waypoint if reached it
         if ((jackNode_->GetPosition() - nextWaypoint).Length() < 0.1f)

+ 4 - 4
Source/Samples/20_HugeObjectCount/HugeObjectCount.cpp

@@ -221,13 +221,13 @@ void HugeObjectCount::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
 }
 
 void HugeObjectCount::AnimateObjects(float timeStep)

+ 4 - 4
Source/Samples/21_AngelScriptIntegration/AngelScriptIntegration.cpp

@@ -184,13 +184,13 @@ void AngelScriptIntegration::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
 }
 
 void AngelScriptIntegration::HandleUpdate(StringHash eventType, VariantMap& eventData)

+ 4 - 4
Source/Samples/22_LuaIntegration/LuaIntegration.cpp

@@ -188,13 +188,13 @@ void LuaIntegration::MoveCamera(float timeStep)
     
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
 }
 
 void LuaIntegration::HandleUpdate(StringHash eventType, VariantMap& eventData)

+ 4 - 4
Source/Samples/23_Water/Water.cpp

@@ -257,13 +257,13 @@ void Water::MoveCamera(float timeStep)
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::FORWARD * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::BACK * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
 
     // In case resolution has changed, adjust the reflection camera aspect ratio
     Graphics* graphics = GetSubsystem<Graphics>();

+ 4 - 6
Source/Samples/24_Urho2DSprite/Urho2DSprite.cpp

@@ -171,16 +171,14 @@ void Urho2DSprite::MoveCamera(float timeStep)
     const float MOVE_SPEED = 4.0f;
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    // Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    // multiply the desired direction with the node's orientation quaternion, and use just Translate()
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::UP * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::UP * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::DOWN* MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::DOWN * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     if (input->GetKeyDown(KEY_PAGEUP))
     {

+ 4 - 6
Source/Samples/27_Urho2DPhysics/Urho2DPhysics.cpp

@@ -194,16 +194,14 @@ void Urho2DPhysics::MoveCamera(float timeStep)
     const float MOVE_SPEED = 4.0f;
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    // Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    // multiply the desired direction with the node's orientation quaternion, and use just Translate()
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::UP * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::UP * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::DOWN* MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::DOWN * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     if (input->GetKeyDown(KEY_PAGEUP))
     {

+ 4 - 6
Source/Samples/28_Urho2DPhysicsRope/Urho2DPhysicsRope.cpp

@@ -183,16 +183,14 @@ void Urho2DPhysicsRope::MoveCamera(float timeStep)
     const float MOVE_SPEED = 4.0f;
 
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    // Use the TranslateRelative() function to move relative to the node's orientation. Alternatively we could
-    // multiply the desired direction with the node's orientation quaternion, and use just Translate()
     if (input->GetKeyDown('W'))
-        cameraNode_->TranslateRelative(Vector3::UP * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::UP * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('S'))
-        cameraNode_->TranslateRelative(Vector3::DOWN* MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::DOWN * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('A'))
-        cameraNode_->TranslateRelative(Vector3::LEFT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
     if (input->GetKeyDown('D'))
-        cameraNode_->TranslateRelative(Vector3::RIGHT * MOVE_SPEED * timeStep);
+        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
     
     if (input->GetKeyDown(KEY_PAGEUP))
     {