[Orxonox-commit 3709] r8389 - in code/branches/mac_osx2: data/levels src/modules/objects
youngk at orxonox.net
youngk at orxonox.net
Mon May 2 22:30:40 CEST 2011
Author: youngk
Date: 2011-05-02 22:30:40 +0200 (Mon, 02 May 2011)
New Revision: 8389
Modified:
code/branches/mac_osx2/data/levels/planets.oxw
code/branches/mac_osx2/src/modules/objects/Planet.cc
Log:
Adding Collision Shapes to Planets. Doesn't currently work.
Modified: code/branches/mac_osx2/data/levels/planets.oxw
===================================================================
--- code/branches/mac_osx2/data/levels/planets.oxw 2011-05-02 20:30:09 UTC (rev 8388)
+++ code/branches/mac_osx2/data/levels/planets.oxw 2011-05-02 20:30:40 UTC (rev 8389)
@@ -1,65 +1,80 @@
+<LevelInfo
+ name = "Planet Demonstration"
+ description = "Demonstration of Planets"
+ tags = "planets"
+/>
+
<?lua
+ include("stats.oxo")
include("HUDTemplates3.oxo")
- include("stats.oxo")
include("templates/lodInformation.oxt")
- include("templates/spaceshipSwallow.oxt")
- include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipHXY.oxt")
?>
-
-
<Level
- name = "Planet_Demo"
- description = "Demonstration of planets with high resolution."
-
+ name = "Planet"
+ description = "Demonstration of Planets"
>
<templates>
- <Template link=lodtemplate_default />
+ <Template link="lodtemplate_default" />
</templates>
<Scene
- ambientlight = "0.5, 0.5, 0.5"
- skybox = "Orxonox/skypanoramagen1"
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/skypanoramagen1"
>
+
+ <WorldAmbientSound
+ ambientSource="AlphaCentauri.ogg"
+ looping="true"
+ playOnLoad="true"
+ />
-<WorldAmbientSound ambientSource="AlphaCentauri.ogg" looping="true" playOnLoad="true" />
-<Light type=directional position="-10000,-10000,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+ <Light
+ type="directional"
+ position="-10000,-10000,0"
+ direction="0.253, 0.593, -0.765"
+ diffuse="1.0, 0.9, 0.9, 1.0"
+ specular="1.0, 0.9, 0.9, 1.0"
+ />
-<?lua
-planetsize=40000
-?>
+ <SpawnPoint
+ position="1500,0,0"
+ lookat="0,0,0"
+ spawnclass="SpaceShip"
+ pawndesign="spaceshipHXY"
+ />
-<SpawnPoint position="<?lua print(math.sin(1.5) *(3)*planetsize) ?>,<?lua print(math.cos(1.5) *3*planetsize) ?>,<?lua print(500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipswallow />
+ <Planet
+ position="0,0,0"
+ scale="1000"
+ collisionType="dynamic"
+ linearDamping="0.8"
+ angularDamping="0"
+ mass="200"
+ pitch="0"
+ mesh="jupiter.mesh"
+ atmosphere="atmosphere1"
+ rotationaxis="1,0,0"
+ rotationrate="1.0"
+ atmospheresize="300.0f"
+ imagesize="1024.0f"
+ >
+ <collisionShapes>
+ <SphereCollisionShape radius="1000" position="0,0,0" />
+ </collisionShapes>
+ </Planet>
-
-<?lua
-max = 50
-
-for i = 1, max, 1
-do
- x = math.sin(i/max*6)*(1.5)*planetsize
- y = i*100
- z = math.cos(i/max*6)*(1.5)*planetsize
- ?>
-<?lua
-for k = 1, 25, 1
-do
-j = math.random()
-?>
-
- <MovableEntity position="<?lua print(x + math.random() * 10000-2500) ?>,<?lua print(y + math.random() * 5000-2500) ?>,<?lua print(z + math.random() * 1000-500) ?>" <?lua if i == 5 then ?> collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> <?lua end ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
- <attached>
- <Model position="0,0,0" scale="<?lua print(j * 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
- </attached>
- <?lua if i == 5 then ?><collisionShapes>
- <SphereCollisionShape radius="<?lua print(j * 70) ?>" />
- </collisionShapes> <?lua end ?>
- </MovableEntity>
-<?lua
-end
-?>
-<?lua end ?>
- <Planet position="0,0,0" scale="<?lua print(planetsize) ?>" pitch=-90 mesh="jupiter.mesh" atmosphere="atmosphere1" rotationaxis="0,1,0" rotationrate="0.2" atmospheresize=300.0f imagesize=1024.0f />
- <Planet position="<?lua print(5*planetsize) ?>,0,0" scale=10000 pitch=30 mesh="ganymede.mesh" atmosphere="atmosphere1" rotationaxis="1,0,1" rotationrate="1.5" atmospheresize=224.0f imagesize=1024.0f />
+ <Planet
+ position="10000,0,0"
+ scale="100"
+ pitch="0"
+ mesh="ganymede.mesh"
+ atmosphere="atmosphere1"
+ rotationaxis="1,0,0"
+ rotationrate="1.0"
+ atmospheresize="224.0f"
+ imagesize="1024.0f"
+ />
</Scene>
</Level>
Modified: code/branches/mac_osx2/src/modules/objects/Planet.cc
===================================================================
--- code/branches/mac_osx2/src/modules/objects/Planet.cc 2011-05-02 20:30:09 UTC (rev 8388)
+++ code/branches/mac_osx2/src/modules/objects/Planet.cc 2011-05-02 20:30:40 UTC (rev 8389)
@@ -36,6 +36,7 @@
#include "core/GameMode.h"
#include "core/XMLPort.h"
#include "Scene.h"
+#include "objects/collisionshapes/SphereCollisionShape.h"
#include "graphics/Camera.h"
#include "CameraManager.h"
@@ -50,6 +51,19 @@
{
RegisterObject(Planet);
this->registerVariables();
+
+ // Get notification about collisions
+ if (GameMode::isMaster())
+ {
+ //this->setMass(1.0);
+ this->enableCollisionCallback();
+ this->setCollisionResponse(false);
+ this->setCollisionType(Static);
+
+ SphereCollisionShape* shape = new SphereCollisionShape(this);
+ //shape->setRadius(20);
+ this->attachCollisionShape(shape);
+ }
}
/**
More information about the Orxonox-commit
mailing list