Professional Documents
Culture Documents
Computer Games
Development
Introduction
Setting Up
Copy
K:\Teaching Materials\CI\CI2510\DG\project
To
C:\apps
4
Experiment
Experiment
<?xml version="1.0"?>
<irr_scene>
<attributes>
<string name="Name" value="root" />
<int name="Id" value="-1" />
<vector3d name="Position" value="0.000000, 0.000000, 0.000000" />
<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
<bool name="Visible" value="true" />
<enum name="AutomaticCulling" value="box" />
<bool name="DebugDataVisible" value="false" />
<bool name="IsDebugObject" value="false" />
</attributes>
Example xml
describing the
scene.
This is from
example.irr
<userData>
<attributes>
<bool name="OccludesLight" value="false" />
</attributes>
</userData>
<node type="mesh">
Gravity
Experiment
10
Camera Location
wchar_t tmp[1000];
int lastFPS = -1;
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, video::SColor(0,200,200,200));
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
swprintf(tmp, 1000, L"(%3.1f,%3.1f,%3.1f)", camera->getPosition().X,
camera->getPosition().Y, camera->getPosition().Z);
device->setWindowCaption(tmp);
lastFPS = fps;
15
16
camera>setPosition(core::vector3df(178.0f,1
17
67.0f,5.0f));
camera->setTarget(core::vector3df(0.0f,167.0f,0.0f));
Gravity + collisions
Gravity + collision
meta,
camera, core::vector3df(15,20,15), // this is how big you are. Middle number
is height, others are the width+breadth
core::vector3df(0,-3,0), // middle number is gravity
core::vector3df(0,15,0)); // the middle number is your head height
20
21
Keyboard movement
22
Keyboard control
SKeyMap keyMap[9];
keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_UP;
keyMap[1].Action = EKA_MOVE_FORWARD;
keyMap[1].KeyCode = KEY_KEY_W;
keyMap[2].Action = EKA_MOVE_BACKWARD;
keyMap[2].KeyCode = KEY_DOWN;
keyMap[3].Action = EKA_MOVE_BACKWARD;
keyMap[3].KeyCode = KEY_KEY_S;
keyMap[4].Action = EKA_STRAFE_LEFT;
keyMap[4].KeyCode = KEY_LEFT;
keyMap[5].Action = EKA_STRAFE_LEFT;
keyMap[5].KeyCode = KEY_KEY_A;
keyMap[6].Action = EKA_STRAFE_RIGHT;
keyMap[6].KeyCode = KEY_RIGHT;
keyMap[7].Action = EKA_STRAFE_RIGHT;
keyMap[7].KeyCode = KEY_KEY_D;
keyMap[8].Action = EKA_JUMP_UP;
keyMap[8].KeyCode = KEY_KEY_J;
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0, 50.0f, .1f, -1, keyMap, 9, false, 0.3f);
23
24
Creating a 3d room
26
27
28