//============================================================================= //============================================================================= void Vehicle::Init() { // This function is called only from the main program when initially creating the vehicle, not on scene load ResourceCache* cache = GetSubsystem<ResourceCache>(); StaticModel* hullObject = node_->CreateComponent<StaticModel>(); hullBody_ = node_->CreateComponent<RigidBody>(); CollisionShape* hullColShape = node_->CreateComponent<CollisionShape>(); hullBody_->SetMass(1200.0f); hullBody_->SetLinearDamping(0.2f); // Some air resistance hullBody_->SetAngularDamping(0.5f); hullBody_->SetCollisionLayer(1); int rightIndex = 0; int upIndex = 1; int forwardIndex = 2; PhysicsWorld *pPhysWorld = GetScene()->GetComponent<PhysicsWorld>(); btDynamicsWorld *pbtDynWorld = (btDynamicsWorld*)pPhysWorld->GetWorld(); m_vehicleRayCaster = new btDefaultVehicleRaycaster( pbtDynWorld ); m_vehicle = new btRaycastVehicle( m_tuning, hullBody_->GetBody(), m_vehicleRayCaster ); pbtDynWorld->addVehicle( m_vehicle ); m_vehicle->setCoordinateSystem( rightIndex, upIndex, forwardIndex ); //Vector3 v3BoxExtents = Vector3::ONE;//Vector3(1.5f, 1.0f, 3.0f); hullObject->SetModel(cache->GetResource<Model>("MyProjects/MiniCooper/test/Chassis_001.mdl")); node_->SetScale( Vector3(1.0f, 1.0f, 1.0f) ); hullColShape->SetConvexHull(cache->GetResource<Model>("MyProjects/MiniCooper/test/collision.mdl")); //hullColShape->SetConvexHull(cache->GetResource<Model>("Models/Box.mdl")); //hullColShape->SetBox((hullObject->GetBoundingBox()).Size()); //hullColShape->SetTriangleMesh(cache->GetResource<Model>("Models/Box.mdl")); //hullColShape->SetSize(Vector3(1.0f, 1.0f, 3.0f)); //hullColShape->SetPosition((hullObject->GetBoundingBox()).Center() - Vector3(0.0f, 0.0f, 0.0f) ); //hullColShape->SetPosition( Vector3(0.0f, +0.2f, 0.0f) ); hullObject->SetCastShadows(true); Node* patricleTest = node_->CreateChild("patricleTest"); patricleTest->LoadXML(cache->GetResource<XMLFile>("MyProjects/MiniCooper/particleTest.xml")->GetRoot()); patricleTest->SetPosition(Vector3(0.0f, 0.2f, -2.0f)); Node* lightTest = node_->CreateChild("lightTest"); lightTest->LoadXML(cache->GetResource<XMLFile>("MyProjects/MiniCooper/lightTest.xml")->GetRoot()); lightTest->SetPosition(Vector3(0.0f, 0.2f, 2.0f)); //float connectionHeight = -0.4f;//1.2f; //float connectionHeight = 0.0f; bool isFrontWheel=true; btVector3 wheelDirectionCS0(0,-1,0); btVector3 wheelAxleCS(1,0,0); double wheelOffset = 0.5; // front right ////////////// Node* node_wheel_temp0 = GetScene()->CreateChild("node_wheel_temp0"); StaticModel* model_wheel_temp0 = node_wheel_temp0->CreateComponent<StaticModel>(); model_wheel_temp0->SetModel(cache->GetResource<Model>("MyProjects/MiniCooper/test/wheel_000.mdl")); model_wheel_temp0->ApplyMaterialList("MyProjects/MiniCooper/test/wheel_000.txt"); model_wheel_temp0->SetCastShadows(true); //btVector3 connectionPointCS0(((model_wheel_temp0->GetBoundingBox()).Center()).x_, ((model_wheel_temp0->GetBoundingBox()).Center()).y_, ((model_wheel_temp0->GetBoundingBox()).Center()).z_); //wheelRadius = model_wheel_temp0->GetBoundingBox().HalfSize().y_; //m_vehicle->addWheel(connectionPointCS0, wheelDirectionCS0, wheelAxleCS, suspensionRestLength, wheelRadius, m_tuning, isFrontWheel); btVector3 connectionPointCS0((model_wheel_temp0->GetBoundingBox()).Center().x_,((model_wheel_temp0->GetBoundingBox()).Center()).y_ + wheelOffset,((model_wheel_temp0->GetBoundingBox()).Center()).z_); m_vehicle->addWheel(connectionPointCS0,wheelDirectionCS0,btVector3(-1,0,0),suspensionRestLength,wheelRadius,m_tuning,isFrontWheel); Node* node_wheel_0 = GetScene()->CreateChild("node_wheel_0"); node_wheel_0->SetPosition((model_wheel_temp0->GetBoundingBox()).Center()); node_wheel_0->SetRotation(Quaternion(0.0f, 0.0f, 90.0f)); node_wheel_temp0->SetParent(node_wheel_0); m_vpNodeWheel.Push( node_wheel_0 ); //SDL_Log( "node_wheel_temp0: %f, %f, %f \n", ((model_wheel_temp0->GetBoundingBox()).Center()).x_, ((model_wheel_temp0->GetBoundingBox()).Center()).y_, ((model_wheel_temp0->GetBoundingBox()).Center()).z_); //SDL_Log( "node_wheel_temp0.HalfSize: %s \n", model_wheel_temp0->GetBoundingBox().HalfSize().ToString().CString() ); //SDL_Log("##################### \n"); //SDL_Log("node_wheel_temp0WorldP: %f, %f, %f \n", node_wheel_temp0->GetWorldPosition().x_, node_wheel_temp0->GetWorldPosition().y_, node_wheel_temp0->GetWorldPosition().z_); //SDL_Log("node_wheel_temp0P: %f, %f, %f \n", node_wheel_temp0->GetPosition().x_, node_wheel_temp0->GetPosition().y_, node_wheel_temp0->GetPosition().z_); //SDL_Log( "model_wheel_temp0BoundP: %f, %f, %f \n", ((model_wheel_temp0->GetBoundingBox()).Center()).x_, ((model_wheel_temp0->GetBoundingBox()).Center()).y_, ((model_wheel_temp0->GetBoundingBox()).Center()).z_); //node_wheel_temp0->SetPosition(node_wheel_temp0->GetPosition() - (model_wheel_temp0->GetBoundingBox()).Center()); //SDL_Log("transform: %f, %f, %f \n", v3Origin.x_, v3Origin.y_, v3Origin.z_); //v3Origin = v3Origin - Vector3(0.704, 0.379, 1.19); //SDL_Log("transform: %f, %f, %f \n", v3Origin.x_, v3Origin.y_, v3Origin.z_); // front left ///////////// Node* node_wheel_temp1 = GetScene()->CreateChild("node_wheel_temp1"); StaticModel* model_wheel_temp1 = node_wheel_temp1->CreateComponent<StaticModel>(); model_wheel_temp1->SetModel(cache->GetResource<Model>("MyProjects/MiniCooper/test/wheel_001.mdl")); model_wheel_temp1->SetCastShadows(true); //btVector3 connectionPointCS0(((model_wheel_temp0->GetBoundingBox()).Center()).x_, ((model_wheel_temp0->GetBoundingBox()).Center()).y_, ((model_wheel_temp0->GetBoundingBox()).Center()).z_); //wheelRadius = model_wheel_temp0->GetBoundingBox().HalfSize().y_; //m_vehicle->addWheel(connectionPointCS0, wheelDirectionCS0, wheelAxleCS, suspensionRestLength, wheelRadius, m_tuning, isFrontWheel); connectionPointCS0 = btVector3((model_wheel_temp1->GetBoundingBox()).Center().x_,((model_wheel_temp1->GetBoundingBox()).Center()).y_ + wheelOffset,((model_wheel_temp1->GetBoundingBox()).Center()).z_); m_vehicle->addWheel(connectionPointCS0,wheelDirectionCS0,btVector3(-1,0,0),suspensionRestLength,wheelRadius,m_tuning,isFrontWheel); Node* node_wheel_1 = GetScene()->CreateChild("node_wheel_1"); node_wheel_1->SetPosition((model_wheel_temp1->GetBoundingBox()).Center()); node_wheel_1->SetRotation(Quaternion(0.0f, 0.0f, -90.0f)); node_wheel_temp1->SetParent(node_wheel_1); m_vpNodeWheel.Push( node_wheel_1 ); isFrontWheel = false; // back right ///////////// Node* node_wheel_temp2 = GetScene()->CreateChild("node_wheel_temp2"); StaticModel* model_wheel_temp2 = node_wheel_temp2->CreateComponent<StaticModel>(); model_wheel_temp2->SetModel(cache->GetResource<Model>("MyProjects/MiniCooper/test/wheel_002.mdl")); model_wheel_temp2->SetCastShadows(true); //btVector3 connectionPointCS0(((model_wheel_temp0->GetBoundingBox()).Center()).x_, ((model_wheel_temp0->GetBoundingBox()).Center()).y_, ((model_wheel_temp0->GetBoundingBox()).Center()).z_); //wheelRadius = model_wheel_temp0->GetBoundingBox().HalfSize().y_; //m_vehicle->addWheel(connectionPointCS0, wheelDirectionCS0, wheelAxleCS, suspensionRestLength, wheelRadius, m_tuning, isFrontWheel); connectionPointCS0 = btVector3((model_wheel_temp2->GetBoundingBox()).Center().x_,((model_wheel_temp2->GetBoundingBox()).Center()).y_ + wheelOffset,((model_wheel_temp2->GetBoundingBox()).Center()).z_); m_vehicle->addWheel(connectionPointCS0,wheelDirectionCS0,btVector3(-1,0,0),suspensionRestLength,wheelRadius,m_tuning,isFrontWheel); Node* node_wheel_2 = GetScene()->CreateChild("node_wheel_2"); node_wheel_2->SetPosition((model_wheel_temp2->GetBoundingBox()).Center()); node_wheel_2->SetRotation(Quaternion(0.0f, 0.0f, 90.0f)); node_wheel_temp2->SetParent(node_wheel_2); m_vpNodeWheel.Push( node_wheel_2 ); // back left ///////////// /// \brief objectNode3 Node* node_wheel_temp3 = GetScene()->CreateChild("node_wheel_temp3"); StaticModel* model_wheel_temp3 = node_wheel_temp3->CreateComponent<StaticModel>(); model_wheel_temp3->SetModel(cache->GetResource<Model>("MyProjects/MiniCooper/test/wheel_003.mdl")); model_wheel_temp3->SetCastShadows(true); //btVector3 connectionPointCS0(((model_wheel_temp0->GetBoundingBox()).Center()).x_, ((model_wheel_temp0->GetBoundingBox()).Center()).y_, ((model_wheel_temp0->GetBoundingBox()).Center()).z_); //wheelRadius = model_wheel_temp0->GetBoundingBox().HalfSize().y_; //m_vehicle->addWheel(connectionPointCS0, wheelDirectionCS0, wheelAxleCS, suspensionRestLength, wheelRadius, m_tuning, isFrontWheel); connectionPointCS0 = btVector3((model_wheel_temp3->GetBoundingBox()).Center().x_,((model_wheel_temp3->GetBoundingBox()).Center()).y_ + wheelOffset,((model_wheel_temp3->GetBoundingBox()).Center()).z_); m_vehicle->addWheel(connectionPointCS0,wheelDirectionCS0,btVector3(-1,0,0),suspensionRestLength,wheelRadius,m_tuning,isFrontWheel); Node* node_wheel_3 = GetScene()->CreateChild("node_wheel_2"); node_wheel_3->SetPosition((model_wheel_temp3->GetBoundingBox()).Center()); node_wheel_3->SetRotation(Quaternion(0.0f, 0.0f, -90.0f)); node_wheel_temp3->SetParent(node_wheel_3); m_vpNodeWheel.Push( node_wheel_3 ); /* for ( int i = 0; i < m_vehicle->getNumWheels(); i++ ) { btWheelInfo& wheel = m_vehicle->getWheelInfo( i ); wheel.m_suspensionStiffness = suspensionStiffness; wheel.m_wheelsDampingRelaxation = suspensionDamping; wheel.m_wheelsDampingCompression = suspensionCompression; wheel.m_frictionSlip = wheelFriction; wheel.m_rollInfluence = rollInfluence; } */ if ( m_vehicle ) { m_vehicle->resetSuspension(); for ( int i = 0; i < m_vehicle->getNumWheels(); i++ ) { //synchronize the wheels with the (interpolated) chassis worldtransform m_vehicle->updateWheelTransform(i,true); btTransform transform = m_vehicle->getWheelTransformWS( i ); /* //Vector3 v3Origin = ToVector3( transform.getOrigin() ); //Quaternion qRot = ToQuaternion( transform.getRotation() ); // create wheel node Node *wheelNode = GetScene()->CreateChild(); //wheelNode->SetPosition( v3Origin ); //btWheelInfo whInfo = m_vehicle->getWheelInfo( i ); //Vector3 v3PosLS = ToVector3( whInfo.m_chassisConnectionPointCS ); //wheelNode->SetRotation( v3PosLS.x_ >= 0.0 ? Quaternion(0.0f, 0.0f, -90.0f) : Quaternion(0.0f, 0.0f, 90.0f) ); //wheelNode->SetScale(Vector3(1.0f, 0.65f, 1.0f)); StaticModel *pWheel = wheelNode->CreateComponent<StaticModel>(); if(i == 0) pWheel->SetModel(cache->GetResource<Model>("MyProjects/SimpeCar/wheel.mdl")); else pWheel->SetModel(cache->GetResource<Model>("MyProjects/SimpeCar/wheel.mdl")); if(i == 0) { //wheelNode->SetPosition( Vector3(50,50,50) ); //wheelNode->SetRotation(Quaternion(0.0f, 0.0f, 0.0f)); }else { //wheelNode->SetPosition( v3Origin ); //wheelNode->SetRotation(Quaternion(0.0f, 0.0f, 0.0f)); } m_vpNodeWheel.Push( wheelNode ); //pWheel->SetModel(cache->GetResource<Model>("MyProjects/MiniCooper/test/wheel_004.mdl")); pWheel->SetMaterial(cache->GetResource<Material>("MyProjects/SimpeCar/TireTextureMaterial.xml")); pWheel->SetCastShadows(true); */ } } }
//------------------- //------------------- void Stage2::Setup(SharedPtr<Scene> scene, SharedPtr<Node> cameraNode) { const String states_[50] = { String("state_1.001.mdl"), String("state_2.001.mdl"), String("state_3.001.mdl"), String("state_4.001.mdl"), String("state_5.001.mdl"), String("state_6.001.mdl"), String("state_7.001.mdl"), String("state_8.001.mdl"), String("state_9.001.mdl"), String("state_10.001.mdl"), String("state_11.001.mdl"), String("state_12.001.mdl"), String("state_13.001.mdl"), String("state_14.001.mdl"), String("state_15.001.mdl"), String("state_16.001.mdl"), String("state_17.001.mdl"), String("state_18.001.mdl"), String("state_19.001.mdl"), String("state_20.001.mdl"), String("state_21.001.mdl"), String("state_22.001.mdl"), String("state_23.001.mdl"), String("state_24.001.mdl"), String("state_25.001.mdl"), String("state_26.001.mdl"), String("state_27.001.mdl"), String("state_28.001.mdl"), String("state_29.001.mdl"), String("state_30.001.mdl"), String("state_31.001.mdl"), String("state_32.001.mdl"), String("state_33.001.mdl"), String("state_34.001.mdl"), String("state_35.001.mdl"), String("state_36.001.mdl"), String("state_37.001.mdl"), String("state_38.001.mdl"), String("state_39.001.mdl"), String("state_40.001.mdl"), String("state_41.001.mdl"), String("state_42.001.mdl"), String("state_43.001.mdl"), String("state_44.001.mdl"), String("state_45.001.mdl"), String("state_46.001.mdl"), String("state_47.001.mdl"), String("state_48.001.mdl"), String("state_49.001.mdl"), String("state_50.001.mdl") }; const Vector3 positions_[50] = { Vector3(0.21888011694f,0.0156500004232f,2.09723997116f), Vector3(2.54229521751f,-0.00904999952763f,1.75292992592f), Vector3(2.41885995865f,-0.00999999977648f,1.90676009655f), Vector3(0.673485100269f,0.0166000016034f,2.30860519409f), Vector3(0.369050145149f,0.0175500009209f,1.11237001419f), Vector3(0.516425132751f,0.0185000002384f,0.181779891253f), Vector3(0.423860132694f,0.0185000002384f,0.481095075607f), Vector3(0.577625155449f,0.0185000002384f,1.04367494583f), Vector3(0.837990105152f,0.0185000002384f,1.52935504913f), Vector3(0.935640096664f,0.0185000002384f,1.02947998047f), Vector3(0.837135195732f,0.0185000002384f,0.446817427874f), Vector3(1.17873501778f,0.0185000002384f,0.342575073242f), Vector3(1.26694011688f,0.0185000002384f,0.743340015411f), Vector3(1.27813506126f,0.0185000002384f,1.56136512756f), Vector3(1.73834013939f,0.0175500009209f,1.89084005356f), Vector3(1.36196017265f,0.0185000002384f,1.13154006004f), Vector3(1.85952007771f,0.0185000002384f,1.51079499722f), Vector3(1.88827514648f,0.000450000166893f,1.21628499031f), Vector3(1.77227497101f,0.0175500009209f,0.656964957714f), Vector3(1.77993512154f,-0.00144999939948f,0.365104973316f), Vector3(2.22174501419f,-0.0052499989979f,0.468360185623f), Vector3(2.69981503487f,-0.0052499989979f,0.614735066891f), Vector3(2.4618601799f,-0.0052499989979f,0.627650141716f), Vector3(2.53034496307f,-0.00810000021011f,1.0825150013f), Vector3(2.75453519821f,-0.00714999902993f,1.07339000702f), Vector3(2.99251008034f,-0.00714999902993f,0.980669975281f), Vector3(3.74992036819f,-0.00810000021011f,0.702120065689f), Vector3(3.66952991486f,-0.00619999971241f,0.732804954052f), Vector3(3.72557497025f,-0.00619999971241f,0.641584992409f), Vector3(3.53317499161f,-0.00904999952763f,1.00545012951f), Vector3(3.5650601387f,-0.00619999971241f,0.886059999466f), Vector3(3.40220499039f,-0.00429999921471f,1.02564501762f), Vector3(3.82462024689f,-0.00239999918267f,0.349364906549f), Vector3(3.70352506638f,-0.0052499989979f,0.491724967957f), Vector3(3.60558986664f,-0.0052499989979f,0.511260032654f), Vector3(3.44979000092f,-0.00429999921471f,0.630430102348f), Vector3(3.3455851078f,-0.0052499989979f,0.875915110111f), Vector3(2.3500752449f,-0.0052499989979f,1.56273007393f), Vector3(3.1991353035f,-0.00144999939948f,1.08977997303f), Vector3(3.26395010948f,-0.00144999939948f,1.17536497116f), Vector3(2.79603528976f,-0.00714999902993f,1.73529994488f), Vector3(2.81455516815f,-0.00144999939948f,1.42764496803f), Vector3(3.25786995888f,-0.00144999939948f,1.38491988182f), Vector3(3.21765995026f,-0.00619999971241f,1.58336496353f), Vector3(3.04369020462f,-0.00429999921471f,1.68953490257f), Vector3(3.07175517082f,-0.00999999977648f,2.11033010483f), Vector3(1.79783010483f,0.0185000002384f,0.926185011864f), Vector3(2.24017524719f,-0.00619999971241f,0.882490038872f), Vector3(2.32092523575f,-0.0052499989979f,1.23307991028f), Vector3(2.81634521484f,-0.00429999921471f,1.25435996056f) }; scene_ = scene; cameraNode_ = cameraNode; ResourceCache* cache = GetSubsystem<ResourceCache>(); // Create scene node & StaticModel component for showing a static plane /*Node* planeNode = scene_->CreateChild("Plane"); planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f)); StaticModel* planeObject = planeNode->CreateComponent<StaticModel>(); planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl")); planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));*/ // Create a Zone component for ambient lighting & fog control Node* zoneNode = scene_->CreateChild("Zone"); Zone* zone = zoneNode->CreateComponent<Zone>(); zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f)); zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f)); zone->SetFogColor(Color(0.5f, 0.5f, 0.7f)); zone->SetFogStart(100.0f); zone->SetFogEnd(300.0f); // Create a directional light to the world. Enable cascaded shadows on it Node* lightNode = scene_->CreateChild("DirectionalLight"); lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); Light* light = lightNode->CreateComponent<Light>(); light->SetLightType(LIGHT_DIRECTIONAL); light->SetCastShadows(true); light->SetShadowBias(BiasParameters(0.00025f, 0.5f)); // Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance light->SetShadowCascade(CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f)); // Create animated models /*const unsigned NUM_MODELS = 100; const float MODEL_MOVE_SPEED = 2.0f; const float MODEL_ROTATE_SPEED = 100.0f; const BoundingBox bounds(Vector3(-47.0f, 0.0f, -47.0f), Vector3(47.0f, 0.0f, 47.0f)); for (unsigned i = 0; i < NUM_MODELS; ++i) { Node* modelNode = scene_->CreateChild("Jack"); modelNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f)); modelNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f)); AnimatedModel* modelObject = modelNode->CreateComponent<AnimatedModel>(); modelObject->SetModel(cache->GetResource<Model>("Models/Jack.mdl")); modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml")); modelObject->SetCastShadows(true); // Create an AnimationState for a walk animation. Its time position will need to be manually updated to advance the // animation, The alternative would be to use an AnimationController component which updates the animation automatically, // but we need to update the model's position manually in any case Animation* walkAnimation = cache->GetResource<Animation>("Models/Jack_Walk.ani"); AnimationState* state = modelObject->AddAnimationState(walkAnimation); // The state would fail to create (return null) if the animation was not found if (state) { // Enable full blending weight and looping state->SetWeight(1.0f); state->SetLooped(true); } // Create our custom Mover component that will move & animate the model during each frame's update //Mover* mover = modelNode->CreateComponent<Mover>(); //mover->SetParameters(MODEL_MOVE_SPEED, MODEL_ROTATE_SPEED, bounds); }*/ { Node* floorNode = scene_->CreateChild("Floor"); floorNode->SetPosition(Vector3(0.0f, -1.0f, 0.0f)); floorNode->SetScale(Vector3(1000.0f, 1.0f, 1000.0f)); StaticModel* floorObject = floorNode->CreateComponent<StaticModel>(); floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl")); floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml")); // Make the floor physical by adding RigidBody and CollisionShape components. The RigidBody's default // parameters make the object static (zero mass.) Note that a CollisionShape by itself will not participate // in the physics simulation /*RigidBody* body = */floorNode->CreateComponent<RigidBody>(); CollisionShape* shape = floorNode->CreateComponent<CollisionShape>(); // Set a box shape of size 1 x 1 x 1 for collision. The shape will be scaled with the scene node scale, so the // rendering and physics representation sizes should match (the box model is also 1 x 1 x 1.) shape->SetBox(Vector3::ONE); } for (unsigned j=0; j<50; ++j) { Node* stateNode = scene_->CreateChild("state"); Vector3 corrected = Vector3(positions_[j].z_,positions_[j].y_,positions_[j].x_)*10.0f; stateNode->SetPosition(corrected); StaticModel* stateModel = stateNode->CreateComponent<StaticModel>(); //stateModel->SetModel( cache->GetResource<Model>(String("Models/States/")+states_[j]) ); stateModel->SetModel( cache->GetResource<Model>(String("Models/States/state_"+String(j+1)+".001.mdl") ) ); RigidBody* body = stateNode->CreateComponent<RigidBody>(); body->SetMass(1.0f); body->SetFriction(0.75f); CollisionShape* sshape = stateNode->CreateComponent<CollisionShape>(); sshape->SetConvexHull(cache->GetResource<Model>(String("Models/States/state_convex_"+String(j+1)+".001.mdl") )); //LOGINFO(positions_[j].ToString()); stateNode->SetPosition(stateNode->GetWorldPosition()+Vector3(0.0f,20.0f+float(j)*0.5,0.0f)); } /*Node* stateNode = scene_->CreateChild("state"); stateNode->SetPosition(positions_[0]); StaticModel* stateModel = stateNode->CreateComponent<StaticModel>(); stateModel->SetModel( cache->GetResource<Model>(String("Models/States/")+states_[0]) );*/ // Create the camera. Limit far clip distance to match the fog //cameraNode_ = scene_->CreateChild("Camera"); //Camera* camera = cameraNode_->CreateComponent<Camera>(); //camera->SetFarClip(300.0f); // Set an initial position for the camera scene node above the plane cameraNode_->SetPosition(Vector3(0.0f, 5.0f, 0.0f)); //give the camera the logic I want //CameraLogic* cameralogic = cameraNode_->CreateComponent<CameraLogic>(); }