Josh Engebretson 10 years ago
parent
commit
8cf58e9d76

+ 20 - 0
Source/AtomicEditor/Source/Editors/SceneEditor3D/SceneEditor3D.cpp

@@ -49,6 +49,26 @@ SceneEditor3D ::SceneEditor3D(Context* context, const String &fullpath, TBTabCon
 
 
     sceneView_ = new SceneView3D(context_, this);
     sceneView_ = new SceneView3D(context_, this);
 
 
+    // EARLY ACCESS
+    if (fullpath.Find(String("ToonTown")) != String::NPOS)
+    {
+          sceneView_->GetCameraNode()->SetWorldPosition(Vector3(-119.073, 76.1121, 16.47763));
+          Quaternion q(0.55, 0.14,  0.8, -0.2);
+          sceneView_->SetYaw(q.YawAngle());
+          sceneView_->SetPitch(q.PitchAngle());
+          sceneView_->GetCameraNode()->SetWorldRotation(q);
+    }
+    else
+    {
+        Node* playerSpawn = scene_->GetChild("PlayerInfoStart", true);
+        if (playerSpawn)
+        {
+            sceneView_->GetCameraNode()->SetPosition(playerSpawn->GetPosition());
+            sceneView_->SetYaw(playerSpawn->GetRotation().EulerAngles().y_);
+        }
+
+    }
+
     TBWidgetDelegate* delegate = sceneView_->GetWidgetDelegate();
     TBWidgetDelegate* delegate = sceneView_->GetWidgetDelegate();
     delegate->SetGravity(WIDGET_GRAVITY_ALL);
     delegate->SetGravity(WIDGET_GRAVITY_ALL);
 
 

+ 4 - 0
Source/AtomicEditor/Source/Editors/SceneEditor3D/SceneView3D.cpp

@@ -121,6 +121,10 @@ void SceneView3D::MoveCamera(float timeStep)
     // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
     // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
     cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
     cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
 
 
+    //Vector3 pos = cameraNode_->GetWorldPosition();
+    //Quaternion q = cameraNode_->GetWorldRotation();
+    //LOGINFOF("%f %f %f : %f %f %f %f", pos.x_, pos.y_, pos.z_, q.x_, q.y_, q.z_, q.w_ );
+
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
     // Use the Translate() function (default local space) to move relative to the node's orientation.
     // Use the Translate() function (default local space) to move relative to the node's orientation.
     if (input->GetKeyDown('W'))
     if (input->GetKeyDown('W'))

+ 3 - 0
Source/AtomicEditor/Source/Editors/SceneEditor3D/SceneView3D.h

@@ -40,6 +40,9 @@ public:
 
 
     bool OnEvent(const TBWidgetEvent &ev);
     bool OnEvent(const TBWidgetEvent &ev);
 
 
+    void SetPitch(float pitch) { pitch_ = pitch; }
+    void SetYaw(float yaw) { yaw_ = yaw; }
+
 private:
 private:
 
 
     bool MouseInView();
     bool MouseInView();