Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 60 and Version 61 of content/LevelHowTo


Ignore:
Timestamp:
Sep 8, 2015, 5:37:04 PM (9 years ago)
Author:
fvultier
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • content/LevelHowTo

    v60 v61  
    147147}}}
    148148
     149== WaypointController ==
     150So far we used only the classes StaticEntity and MovableEntity. There is another important WorldEntity derivative you should know: the ControllableEntity. A ControllableEntity is controlled by a controller (an instance of the class Controller). This controller executes steering commands on the ControllableEntity.
     151By using Controller and ControllableEntity you can create objects that move in the space along any path you like.
     152The simplest case of a Controller is the WaypointController:
     153{{{
     154#!xml
     155<SpaceShip position="300,0,0" lookat="0,0,0" team=3>
     156    <templates>
     157        <Template link=spaceshipescort />
     158    </templates>
     159    <controller>
     160        <WaypointPatrolController accuracy=10 team=3>
     161            <waypoints>
     162                <Model mesh="cube.mesh" scale=8 position="300,0,0" />
     163                <Model mesh="cube.mesh" scale=8 position="300,500,0" />
     164                <Model mesh="cube.mesh" scale=8 position="0,500,0" />
     165                <StaticEntity position="0,0,0" />
     166            </waypoints>
     167        </WaypointPatrolController>
     168    </controller>
     169</SpaceShip>
     170}}}
     171In this example the SpaceShip (The SpaceShip class is a derivative of the ControllableEntity class) is controlled by a WaypointController. The ship will fly from its starting position to the first cube. There it will change its direction and fly to the second cube ... When the SpaceShip arrived at the last waypoint in the list it will continue at the top of the list again.
     172If you want the waypoints to be invisible just replace Model by StaticEntity as done for the last waypoint in the list above.
     173
     174Take a look at the "waypoints.oxw" level to learn more about the WaypointController.
     175
    149176== [http://www.orxonox.net/doxygen/classorxonox_1_1_pickup_spawner.html Pickups]  ==
    150177Pickups give a player a temporary bonus when collecting it. Bonuses are invisibility, health, boost,  shield, a drone, ...
     
    217244
    218245Have a look at "myTestLevel.oxw" and "SpaceBoundaries.h", to see how space boundaries work in detail.
     246
     247== Planets ==
     248Planets are a nice addition to many levels. Use the Planet class to add a planet to a level.
     249{{{
     250#!xml
     251<Planet
     252      position="10000,0,0"
     253      scale="100"
     254      collisionType="dynamic"
     255      linearDamping="0.8"
     256      angularDamping="0"
     257      mass="5000000"
     258      pitch="0"
     259      mesh="planets/muunilinst.mesh"
     260      atmosphere="atmosphere1"
     261      rotationaxis="1,0,0"
     262      rotationrate="1.0"
     263      atmospheresize="80.0f"
     264      imagesize="1024.0f"
     265      collisiondamage = 2
     266      enablecollisiondamage = true
     267    >
     268    <attached>
     269        <ForceField position="0,0,0" mode="sphere" diameter="1000" velocity="-500" />
     270    </attached>
     271    <collisionShapes>
     272        <SphereCollisionShape radius="100" position="0,0,0" />
     273    </collisionShapes>
     274</Planet>
     275}}}
     276
     277Notice that in this example there is a force field attached to the planet to simulate gravitation. The planet also has a collision shape.
     278Have a look at "planets.oxw" and "Planet.h", to see how planets work in detail.
    219279
    220280== Portals ==