SceneView3D.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. // Portions Copyright (c) 2008-2015 the Urho3D project.
  2. //
  3. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  4. // LICENSE: Atomic Game Engine Editor and Tools EULA
  5. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  6. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  7. //
  8. #include <Atomic/IO/Log.h>
  9. #include <Atomic/Core/CoreEvents.h>
  10. #include <Atomic/Scene/SceneEvents.h>
  11. #include <Atomic/Scene/Scene.h>
  12. #include <Atomic/Scene/PrefabComponent.h>
  13. #include <Atomic/Graphics/Camera.h>
  14. #include <Atomic/Graphics/Graphics.h>
  15. #include <Atomic/Graphics/DebugRenderer.h>
  16. #include <Atomic/Graphics/Viewport.h>
  17. #include <Atomic/Graphics/Octree.h>
  18. #include <Atomic/Graphics/Material.h>
  19. #include <Atomic/Atomic3D/Terrain.h>
  20. #include <Atomic/Atomic3D/Model.h>
  21. #include <Atomic/Atomic3D/StaticModel.h>
  22. #include <Atomic/Atomic3D/AnimatedModel.h>
  23. #include <Atomic/Atomic3D/AnimationController.h>
  24. #include <Atomic/Input/Input.h>
  25. #include <Atomic/IO/FileSystem.h>
  26. #include <Atomic/Resource/ResourceCache.h>
  27. #include <Atomic/Resource/XMLFile.h>
  28. #include <Atomic/Physics/PhysicsWorld.h>
  29. #include <Atomic/UI/UI.h>
  30. #include <Atomic/UI/UIEvents.h>
  31. #include <Atomic/Resource/ResourceEvents.h>
  32. #include <ToolCore/Assets/Asset.h>
  33. #include <ToolCore/Assets/AssetDatabase.h>
  34. #include "../../EditorMode/AEEditorEvents.h"
  35. #include "SceneView3D.h"
  36. #include "SceneEditor3D.h"
  37. #include "SceneEditor3DEvents.h"
  38. using namespace ToolCore;
  39. namespace AtomicEditor
  40. {
  41. SceneView3D ::SceneView3D(Context* context, SceneEditor3D *sceneEditor) :
  42. UISceneView(context),
  43. yaw_(0.0f),
  44. pitch_(0.0f),
  45. mouseLeftDown_(false),
  46. mouseMoved_(false),
  47. enabled_(true),
  48. cameraMove_(false)
  49. {
  50. sceneEditor_ = sceneEditor;
  51. ResourceCache* cache = GetSubsystem<ResourceCache>();
  52. scene_ = sceneEditor->GetScene();
  53. debugRenderer_ = scene_->GetComponent<DebugRenderer>();
  54. if (debugRenderer_.Null())
  55. {
  56. debugRenderer_ = scene_->CreateComponent<DebugRenderer>();
  57. }
  58. octree_ = scene_->GetComponent<Octree>();
  59. if (octree_.Null())
  60. {
  61. LOGWARNING("Scene without an octree loaded");
  62. octree_ = scene_->CreateComponent<Octree>();
  63. }
  64. cameraNode_ = scene_->CreateChild("__atomic_sceneview3d_camera");
  65. cameraNode_->SetTemporary(true);
  66. camera_ = cameraNode_->CreateComponent<Camera>();
  67. debugRenderer_ = scene_->GetComponent<DebugRenderer>();
  68. assert(debugRenderer_.NotNull());
  69. octree_ = scene_->GetComponent<Octree>();
  70. assert(octree_.NotNull());
  71. cameraNode_->SetPosition(Vector3(0, 0, -10));
  72. SetView(scene_, camera_);
  73. SetAutoUpdate(false);
  74. SubscribeToEvent(E_UPDATE, HANDLER(SceneView3D, HandleUpdate));
  75. SubscribeToEvent(E_EDITORACTIVENODECHANGE, HANDLER(SceneView3D, HandleEditorActiveNodeChange));
  76. SubscribeToEvent(E_POSTRENDERUPDATE, HANDLER(SceneView3D, HandlePostRenderUpdate));
  77. SubscribeToEvent(scene_, E_NODEREMOVED, HANDLER(SceneView3D, HandleNodeRemoved));
  78. SubscribeToEvent(E_MOUSEMOVE, HANDLER(SceneView3D,HandleMouseMove));
  79. SubscribeToEvent(this, E_DRAGENTERWIDGET, HANDLER(SceneView3D, HandleDragEnterWidget));
  80. SubscribeToEvent(this, E_DRAGEXITWIDGET, HANDLER(SceneView3D, HandleDragExitWidget));
  81. SubscribeToEvent(this, E_DRAGENDED, HANDLER(SceneView3D, HandleDragEnded));
  82. SubscribeToEvent(E_UIUNHANDLEDSHORTCUT, HANDLER(SceneView3D, HandleUIUnhandledShortcut));
  83. SubscribeToEvent(E_UIWIDGETFOCUSESCAPED, HANDLER(SceneView3D, HandleUIWidgetFocusEscaped));
  84. SetIsFocusable(true);
  85. }
  86. SceneView3D::~SceneView3D()
  87. {
  88. }
  89. void SceneView3D::Enable()
  90. {
  91. if (enabled_)
  92. return;
  93. enabled_ = true;
  94. SetVisibility(UI_WIDGET_VISIBILITY_VISIBLE);
  95. }
  96. void SceneView3D::Disable()
  97. {
  98. if (!enabled_)
  99. return;
  100. enabled_ = false;
  101. SetVisibility(UI_WIDGET_VISIBILITY_INVISIBLE);
  102. }
  103. bool SceneView3D::GetOrbitting()
  104. {
  105. Input* input = GetSubsystem<Input>();
  106. return framedNode_.NotNull() && MouseInView() && input->GetKeyDown(KEY_ALT) && input->GetMouseButtonDown(MOUSEB_LEFT);
  107. }
  108. void SceneView3D::MoveCamera(float timeStep)
  109. {
  110. if (!enabled_ && !GetFocus())
  111. return;
  112. Input* input = GetSubsystem<Input>();
  113. bool mouseInView = MouseInView();
  114. bool orbitting = GetOrbitting();
  115. // Movement speed as world units per second
  116. float MOVE_SPEED = 20.0f;
  117. // Mouse sensitivity as degrees per pixel
  118. const float MOUSE_SENSITIVITY = 0.2f;
  119. if (input->GetKeyDown(KEY_LSHIFT) || input->GetKeyDown(KEY_RSHIFT))
  120. MOVE_SPEED *= 3.0f;
  121. // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
  122. if ((mouseInView && input->GetMouseButtonDown(MOUSEB_RIGHT)) || orbitting)
  123. {
  124. SetFocus();
  125. IntVector2 mouseMove = input->GetMouseMove();
  126. yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
  127. pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
  128. pitch_ = Clamp(pitch_, -90.0f, 90.0f);
  129. }
  130. // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
  131. Quaternion q(pitch_, yaw_, 0.0f);
  132. cameraNode_->SetRotation(q);
  133. if (orbitting)
  134. {
  135. BoundingBox bbox;
  136. sceneEditor_->GetSelectionBoundingBox(bbox);
  137. if (bbox.defined_)
  138. {
  139. Vector3 centerPoint = bbox.Center();
  140. Vector3 d = cameraNode_->GetWorldPosition() - centerPoint;
  141. cameraNode_->SetWorldPosition(centerPoint - q * Vector3(0.0, 0.0, d.Length()));
  142. }
  143. }
  144. #ifdef ATOMIC_PLATFORM_WINDOWS
  145. bool superdown = input->GetKeyDown(KEY_LCTRL) || input->GetKeyDown(KEY_RCTRL);
  146. #else
  147. bool superdown = input->GetKeyDown(KEY_LGUI) || input->GetKeyDown(KEY_RGUI);
  148. #endif
  149. if (!orbitting && mouseInView && !superdown && input->GetMouseButtonDown(MOUSEB_RIGHT)) {
  150. // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
  151. // Use the Translate() function (default local space) to move relative to the node's orientation.
  152. if (input->GetKeyDown(KEY_W))
  153. {
  154. SetFocus();
  155. cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
  156. }
  157. if (input->GetKeyDown(KEY_S))
  158. {
  159. SetFocus();
  160. cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
  161. }
  162. if (input->GetKeyDown(KEY_A))
  163. { SetFocus();
  164. cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
  165. }
  166. if (input->GetKeyDown(KEY_D))
  167. {
  168. SetFocus();
  169. cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
  170. }
  171. if (input->GetKeyDown(KEY_Q))
  172. {
  173. SetFocus();
  174. cameraNode_->Translate(Vector3::UP * MOVE_SPEED * timeStep);
  175. }
  176. if (input->GetKeyDown(KEY_E))
  177. {
  178. SetFocus();
  179. cameraNode_->Translate(Vector3::DOWN * MOVE_SPEED * timeStep);
  180. }
  181. }
  182. else if (!superdown)
  183. {
  184. if (input->GetKeyPress(KEY_F))
  185. {
  186. FrameSelection();
  187. }
  188. }
  189. if (cameraMove_)
  190. {
  191. cameraMoveTime_ += timeStep * 3.0f;
  192. if (cameraMoveTime_ > 1.0f)
  193. {
  194. cameraMove_ = false;
  195. cameraMoveTime_ = 1.0f;
  196. }
  197. Vector3 pos = cameraMoveStart_.Lerp(cameraMoveTarget_, cameraMoveTime_);
  198. cameraNode_->SetWorldPosition(pos);
  199. }
  200. }
  201. Ray SceneView3D::GetCameraRay()
  202. {
  203. Ray camRay;
  204. Input* input = GetSubsystem<Input>();
  205. IntVector2 cpos = input->GetMousePosition();
  206. IntRect rect = GetRect();
  207. if (!rect.Width() || !rect.Height())
  208. return camRay;
  209. int x = rect.left_;
  210. int y = rect.top_;
  211. GetInternalWidget()->ConvertToRoot(x, y);
  212. return camera_->GetScreenRay(float(cpos.x_ - x) / rect.Width(),
  213. float(cpos.y_ - y) / rect.Height());
  214. }
  215. void SceneView3D::DrawNodeDebug(Node* node, DebugRenderer* debug, bool drawNode)
  216. {
  217. if (drawNode)
  218. debug->AddNode(node, 1.0, false);
  219. // Exception for the scene to avoid bringing the editor to its knees: drawing either the whole hierarchy or the subsystem-
  220. // components can have a large performance hit. Also do not draw terrain child nodes due to their large amount
  221. // (TerrainPatch component itself draws nothing as debug geometry)
  222. if (node != scene_ && !node->GetComponent<Terrain>())
  223. {
  224. const Vector<SharedPtr<Component> >& components = node->GetComponents();
  225. for (unsigned j = 0; j < components.Size(); ++j)
  226. components[j]->DrawDebugGeometry(debug, false);
  227. // To avoid cluttering the view, do not draw the node axes for child nodes
  228. for (unsigned k = 0; k < node->GetNumChildren(); ++k)
  229. DrawNodeDebug(node->GetChild(k), debug, false);
  230. }
  231. }
  232. bool SceneView3D::MouseInView()
  233. {
  234. if (!GetInternalWidget())
  235. return false;
  236. if (!TBWidget::hovered_widget || TBWidget::hovered_widget->GetDelegate() != this)
  237. return false;
  238. Input* input = GetSubsystem<Input>();
  239. IntVector2 pos = input->GetMousePosition();
  240. IntRect rect = GetRect();
  241. GetInternalWidget()->ConvertToRoot(rect.left_, rect.top_);
  242. GetInternalWidget()->ConvertToRoot(rect.right_, rect.bottom_);
  243. return rect.IsInside(pos);
  244. }
  245. void SceneView3D::HandleUIUnhandledShortcut(StringHash eventType, VariantMap& eventData)
  246. {
  247. if (!enabled_)
  248. return;
  249. unsigned id = eventData[UIUnhandledShortcut::P_REFID].GetUInt();
  250. if (id == TBIDC("undo"))
  251. sceneEditor_->Undo();
  252. else if (id == TBIDC("redo"))
  253. sceneEditor_->Redo();
  254. return;
  255. }
  256. void SceneView3D::HandleUIWidgetFocusEscaped(StringHash eventType, VariantMap& eventData)
  257. {
  258. if (!enabled_)
  259. return;
  260. SetFocus();
  261. }
  262. void SceneView3D::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
  263. {
  264. // Visualize the currently selected nodes
  265. if (selectedNode_.NotNull())
  266. {
  267. DrawNodeDebug(selectedNode_, debugRenderer_);
  268. }
  269. if (!MouseInView() || GetOrbitting())
  270. return;
  271. Input* input = GetSubsystem<Input>();
  272. mouseLeftDown_ = false;
  273. if (input->GetMouseButtonPress(MOUSEB_LEFT))
  274. {
  275. SetFocus();
  276. if (!mouseMoved_ && !sceneEditor_->GetGizmo()->Selected())
  277. {
  278. Ray camRay = GetCameraRay();
  279. PODVector<RayQueryResult> result;
  280. RayOctreeQuery query(result, camRay, RAY_TRIANGLE, camera_->GetFarClip(), DRAWABLE_GEOMETRY, 0x7fffffff);
  281. octree_->RaycastSingle(query);
  282. if (query.result_.Size())
  283. {
  284. const RayQueryResult& r = result[0];
  285. if (r.drawable_)
  286. {
  287. VariantMap neventData;
  288. Node* node = r.drawable_->GetNode();
  289. // if temporary, this is a prefab
  290. // TODO: if we use temporary for other stuff
  291. // fix this to look for prefab
  292. if (node->IsTemporary())
  293. node = node->GetParent();
  294. neventData[EditorActiveNodeChange::P_NODE] = node;
  295. SendEvent(E_EDITORACTIVENODECHANGE, neventData);
  296. }
  297. }
  298. }
  299. mouseMoved_ = false;
  300. }
  301. else if (!input->GetMouseButtonDown(MOUSEB_LEFT))
  302. {
  303. Ray camRay = GetCameraRay();
  304. PODVector<RayQueryResult> result;
  305. mouseMoved_ = false;
  306. /*
  307. Array<int> pickModeDrawableFlags = {
  308. DRAWABLE_GEOMETRY,
  309. DRAWABLE_LIGHT,
  310. DRAWABLE_ZONE
  311. };
  312. */
  313. RayOctreeQuery query(result, camRay, RAY_TRIANGLE, camera_->GetFarClip(), DRAWABLE_GEOMETRY, 0x7fffffff);
  314. octree_->RaycastSingle(query);
  315. if (query.result_.Size())
  316. {
  317. const RayQueryResult& r = result[0];
  318. if (r.drawable_)
  319. {
  320. debugRenderer_->AddNode(r.drawable_->GetNode(), 1.0, false);
  321. r.drawable_->DrawDebugGeometry(debugRenderer_, false);
  322. }
  323. }
  324. }
  325. else
  326. {
  327. mouseLeftDown_ = true;
  328. if (Abs(input->GetMouseMoveX() > 3 || input->GetMouseMoveY() > 3))
  329. {
  330. mouseMoved_ = true;
  331. }
  332. }
  333. }
  334. void SceneView3D::SelectNode(Node* node)
  335. {
  336. selectedNode_ = node;
  337. }
  338. bool SceneView3D::OnEvent(const TBWidgetEvent &ev)
  339. {
  340. if (ev.type == EVENT_TYPE_SHORTCUT)
  341. {
  342. if (ev.ref_id == TBIDC("close"))
  343. return false;
  344. }
  345. return sceneEditor_->OnEvent(ev);
  346. }
  347. void SceneView3D::HandleUpdate(StringHash eventType, VariantMap& eventData)
  348. {
  349. // Timestep parameter is same no matter what event is being listened to
  350. float timeStep = eventData[Update::P_TIMESTEP].GetFloat();
  351. MoveCamera(timeStep);
  352. QueueUpdate();
  353. if (preloadResourceScene_.NotNull())
  354. {
  355. if (preloadResourceScene_->GetAsyncProgress() == 1.0f)
  356. {
  357. ResourceCache* cache = GetSubsystem<ResourceCache>();
  358. XMLFile* xml = cache->GetResource<XMLFile>(dragAssetGUID_);
  359. if (dragNode_.NotNull())
  360. {
  361. dragNode_->LoadXML(xml->GetRoot());
  362. UpdateDragNode(0, 0);
  363. AnimationController* controller = dragNode_->GetComponent<AnimationController>();
  364. if (controller)
  365. {
  366. controller->PlayExclusive("Idle", 0, true);
  367. dragNode_->GetScene()->SetUpdateEnabled(true);
  368. }
  369. }
  370. preloadResourceScene_ = 0;
  371. dragAssetGUID_ = "";
  372. }
  373. }
  374. }
  375. void SceneView3D::HandleEditorActiveNodeChange(StringHash eventType, VariantMap& eventData)
  376. {
  377. Node* node = (Node*) (eventData[EditorActiveNodeChange::P_NODE].GetPtr());
  378. SelectNode(node);
  379. }
  380. void SceneView3D::HandleNodeRemoved(StringHash eventType, VariantMap& eventData)
  381. {
  382. Node* node = (Node*) (eventData[NodeRemoved::P_NODE].GetPtr());
  383. if (node == selectedNode_)
  384. SelectNode(0);
  385. }
  386. void SceneView3D::UpdateDragNode(int mouseX, int mouseY)
  387. {
  388. if (dragNode_.Null())
  389. return;
  390. Ray ray = GetCameraRay();
  391. Vector3 pos = ray.origin_;
  392. pos += ray.direction_ * 10;
  393. dragNode_->SetWorldPosition(pos);
  394. }
  395. void SceneView3D::HandleMouseMove(StringHash eventType, VariantMap& eventData)
  396. {
  397. if (dragNode_.Null())
  398. return;
  399. Input* input = GetSubsystem<Input>();
  400. if (!input->IsMouseVisible())
  401. return;
  402. using namespace MouseMove;
  403. int x = eventData[P_X].GetInt();
  404. int y = eventData[P_Y].GetInt();
  405. UpdateDragNode(x, y);
  406. }
  407. void SceneView3D::HandleDragEnterWidget(StringHash eventType, VariantMap& eventData)
  408. {
  409. using namespace DragEnterWidget;
  410. UIWidget* widget = static_cast<UIWidget*>(eventData[P_WIDGET].GetPtr());
  411. if (widget != this)
  412. return;
  413. UIDragObject* dragObject = static_cast<UIDragObject*>(eventData[P_DRAGOBJECT].GetPtr());
  414. Object* object = dragObject->GetObject();
  415. if (!object)
  416. return;
  417. if (object->GetType() == Asset::GetTypeStatic())
  418. {
  419. Asset* asset = (Asset*) object;
  420. dragNode_ = asset->InstantiateNode(scene_, asset->GetName());
  421. if (dragNode_.NotNull())
  422. {
  423. Input* input = GetSubsystem<Input>();
  424. IntVector2 pos = input->GetMousePosition();
  425. UpdateDragNode(pos.x_, pos.y_);
  426. }
  427. //LOGINFOF("Dropped %s : %s on SceneView3D", asset->GetPath().CString(), asset->GetGUID().CString());
  428. }
  429. }
  430. void SceneView3D::HandleDragExitWidget(StringHash eventType, VariantMap& eventData)
  431. {
  432. if (preloadResourceScene_.NotNull())
  433. {
  434. preloadResourceScene_->StopAsyncLoading();
  435. preloadResourceScene_ = 0;
  436. }
  437. if (dragNode_.NotNull())
  438. {
  439. scene_->RemoveChild(dragNode_);
  440. }
  441. dragAssetGUID_ = "";
  442. dragNode_ = 0;
  443. }
  444. void SceneView3D::HandleDragEnded(StringHash eventType, VariantMap& eventData)
  445. {
  446. using namespace DragEnded;
  447. UIDragObject* dragObject = static_cast<UIDragObject*>(eventData[P_DRAGOBJECT].GetPtr());
  448. if (dragNode_.NotNull())
  449. {
  450. VariantMap neventData;
  451. neventData[EditorActiveNodeChange::P_NODE] = dragNode_;
  452. SendEvent(E_EDITORACTIVENODECHANGE, neventData);
  453. VariantMap editData;
  454. editData[SceneEditNodeAddedRemoved::P_SCENE] = scene_;
  455. editData[SceneEditNodeAddedRemoved::P_NODE] = dragNode_;
  456. editData[SceneEditNodeAddedRemoved::P_ADDED] = true;
  457. scene_->SendEvent(E_SCENEEDITNODEADDEDREMOVED, editData);
  458. }
  459. if (dragObject && dragObject->GetObject()->GetType() == ToolCore::Asset::GetTypeStatic())
  460. {
  461. Asset* asset = (ToolCore::Asset*) dragObject->GetObject();
  462. if (asset->GetImporterTypeName() == "MaterialImporter") {
  463. Material* material = GetSubsystem<ResourceCache>()->GetResource<Material>(asset->GetPath());
  464. if (material) {
  465. material = material;
  466. Ray camRay = GetCameraRay();
  467. PODVector<RayQueryResult> result;
  468. RayOctreeQuery query(result, camRay, RAY_TRIANGLE, camera_->GetFarClip(), DRAWABLE_GEOMETRY, 0x7fffffff);
  469. octree_->RaycastSingle(query);
  470. if (query.result_.Size())
  471. {
  472. const RayQueryResult& r = result[0];
  473. if (r.drawable_ && (r.drawable_->GetType() == StaticModel::GetTypeStatic() || r.drawable_->GetType() == AnimatedModel::GetTypeStatic()))
  474. {
  475. ((StaticModel*)r.drawable_)->SetMaterial(material);
  476. }
  477. }
  478. }
  479. }
  480. }
  481. dragAssetGUID_ = "";
  482. dragNode_ = 0;
  483. }
  484. void SceneView3D::FrameSelection()
  485. {
  486. BoundingBox bbox;
  487. sceneEditor_->GetSelectionBoundingBox(bbox);
  488. if (!bbox.defined_)
  489. return;
  490. Sphere sphere(bbox);
  491. if (sphere.radius_ < .01f || sphere.radius_ > 512)
  492. return;
  493. framedNode_ = selectedNode_;
  494. cameraMoveStart_ = cameraNode_->GetWorldPosition();
  495. cameraMoveTarget_ = bbox.Center() - (cameraNode_->GetWorldDirection() * sphere.radius_ * 3);
  496. cameraMoveTime_ = 0.0f;
  497. cameraMove_ = true;
  498. }
  499. }