Changeset 2374 for code/branches/physics/src/orxonox/objects/Scene.cc
- Timestamp:
- Dec 10, 2008, 1:38:17 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/orxonox/objects/Scene.cc
r2315 r2374 43 43 #include "core/Core.h" 44 44 #include "core/XMLPort.h" 45 #include "tools/BulletConversions.h" 45 46 #include "objects/worldentities/WorldEntity.h" 46 47 … … 117 118 XMLPortParam(Scene, "shadow", setShadow, getShadow, xmlelement, mode).defaultValues(true); 118 119 119 const int defaultMaxWorldSize = 100000;120 Vector3 worldAabbMin(-defaultMaxWorldSize, -defaultMaxWorldSize, -defaultMaxWorldSize);121 Vector3 worldAabbMax( defaultMaxWorldSize, defaultMaxWorldSize, defaultMaxWorldSize);122 XMLPortParamVariable(Scene, "negativeWorldRange", worldAabbMin, xmlelement, mode);123 XMLPortParamVariable(Scene, "positiveWorldRange", worldAabbMax, xmlelement, mode);124 XMLPortParam(Scene, "hasPhysics", setPhysicalWorld, hasPhysics, xmlelement, mode).defaultValue(0, true) .defaultValue(1, worldAabbMin).defaultValue(2, worldAabbMax);120 //const int defaultMaxWorldSize = 100000; 121 //Vector3 worldAabbMin(-defaultMaxWorldSize, -defaultMaxWorldSize, -defaultMaxWorldSize); 122 //Vector3 worldAabbMax( defaultMaxWorldSize, defaultMaxWorldSize, defaultMaxWorldSize); 123 //XMLPortParamVariable(Scene, "negativeWorldRange", worldAabbMin, xmlelement, mode); 124 //XMLPortParamVariable(Scene, "positiveWorldRange", worldAabbMax, xmlelement, mode); 125 XMLPortParam(Scene, "hasPhysics", setPhysicalWorld, hasPhysics, xmlelement, mode).defaultValue(0, true);//.defaultValue(1, worldAabbMin).defaultValue(2, worldAabbMax); 125 126 126 127 XMLPortObjectExtended(Scene, BaseObject, "", addObject, getObject, xmlelement, mode, true, false); … … 131 132 REGISTERSTRING(this->skybox_, network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox)); 132 133 REGISTERDATA(this->ambientLight_, network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight)); 133 } 134 135 void Scene::setPhysicalWorld(bool wantPhysics, const Vector3& worldAabbMin, const Vector3& worldAabbMax) 136 { 134 REGISTERDATA(this->bHasPhysics_, network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_hasPhysics)); 135 } 136 137 void Scene::setPhysicalWorld(bool wantPhysics)//, const Vector3& worldAabbMin, const Vector3& worldAabbMax) 138 { 139 this->bHasPhysics_ = wantPhysics; 137 140 if (wantPhysics && !hasPhysics()) 138 141 { 139 140 141 142 btVector3 worldAabbMin( x,y,z);143 144 145 146 btVector3 worldAabbMax( x,y,z);142 //float x = worldAabbMin.x; 143 //float y = worldAabbMin.y; 144 //float z = worldAabbMin.z; 145 btVector3 worldAabbMin(-100000, -100000, -100000); 146 //x = worldAabbMax.x; 147 //y = worldAabbMax.y; 148 //z = worldAabbMax.z; 149 btVector3 worldAabbMax(100000, 100000, 100000); 147 150 148 151 btDefaultCollisionConfiguration* collisionConfig = new btDefaultCollisionConfiguration(); … … 173 176 { 174 177 if (!(*it)->isInWorld()) 178 { 179 //COUT(0) << "body position: " << omni_cast<Vector3>((*it)->getWorldTransform().getOrigin()) << std::endl; 180 //COUT(0) << "body velocity: " << omni_cast<Vector3>((*it)->getLinearVelocity()) << std::endl; 181 //COUT(0) << "body orientation: " << omni_cast<Quaternion>((*it)->getWorldTransform().getRotation()) << std::endl; 182 //COUT(0) << "body angular: " << omni_cast<Vector3>((*it)->getAngularVelocity()) << std::endl; 183 //COUT(0) << "body mass: " << omni_cast<float>((*it)->getInvMass()) << std::endl; 184 //COUT(0) << "body inertia: " << omni_cast<Vector3>((*it)->getInvInertiaDiagLocal()) << std::endl; 175 185 this->physicalWorld_->addRigidBody(*it); 186 } 176 187 } 177 188 this->physicsQueue_.clear(); … … 234 245 { 235 246 if (!this->physicalWorld_) 236 COUT(1) << "Error: Cannot WorldEntity body to physical Scene: No physics." << std::endl;247 COUT(1) << "Error: Cannot add WorldEntity body to physical Scene: No physics." << std::endl; 237 248 else if (body) 238 249 this->physicsQueue_.insert(body); … … 242 253 { 243 254 if (!this->physicalWorld_) 244 COUT(1) << "Error: Cannot WorldEntity body tophysical Scene: No physics." << std::endl;255 COUT(1) << "Error: Cannot remove WorldEntity body from physical Scene: No physics." << std::endl; 245 256 else if (body) 246 257 {
Note: See TracChangeset
for help on using the changeset viewer.