

Basically, you've just created a very, very basic first person shooter game. Test your application, if you now aim at the enemy soldier and click the left mouse button, he should die after you hit him twice. The "shoot" action added to the player camera.įor the shoot action, we set as Damage a value of about 55 (the default health for the enemy is 100, so you will have to hit him twice), and then click 'OK'. The behavior has one entry named "Action", select it, and click the "." button and in the action edit dialog, add a "Shoot" action, which can be found under "game and sound": You can select any key you want, but for this example, I selected the 'Left Mouse button' as shooting key. Select the camera again we created before, go to its behavior tab, and add a "When a key is pressed do something" behavior to it, you can find it under "Behaviors triggered by events". So in order to do this, we need to add a weapon for the player. The one main feature of First Person Shooter games is that you can shoot stuff in them. We are doing this here because the soldier 3D model doesn't have a "death" animation built-in.

But the action we just added rotates the character so that it looks like it falls to the ground. It could be useful to add further actions there, like playing a sound or similar, if you like. This action will be executed when the Actor dies. Our action which gets run when the Actor dies. Place the soldier somewhere you like it to be. In the prefab window, simple double click the "Animated soldier" and CopperCube should create an instance of this character in your 3D world. There is a 'Soldier' prefab available which comes with CopperCube. But for a game, we need a bit more.Īs enemies, we will use some animated characters. So now we have a camera which can move in the 3D world. If you want to change the gravity, adjust the value of 'Gravity' which you can find when selecting the root node of the scene in the SceneGraph Explorer. You can adjust the size of the ellipsoid and the position of the camera in the ellipsoid. The second behavior in the camera is the 'Collide when moved' behavior, which influences how the camera collides with its environment. If you want the camera to be able to fly instead of walk, you can check the 'CanFly' option, but for this tutorial, we don't use this feature. You can set various options there, like the movement or rotation speed. Now go to the properties window of the camera, open the 'Behaviors' tab and select the 'First Person Shooter style controlled' behavior:
#COPPERCUBE FIRST PERSON TUTOR WINDOWS#
You can try if your camera is ok by testing your app, for example clicking Tools -> Test as Windows Application, and move around in your 3d scene a bit. You can use the scale tool (shortcut 'R') to change the size of the ellipsoid.Īlso, be sure that the yellow ellipsoid 'flies' a bit in the air and that it doesn't touch any wall or floor in the beginning, otherwise the user would be stuck in that wall at the start of the application and would not be able to move.

You need to make it big enough that it is possible for the user to climb stairs, but small enough to fit through doors. Maybe you need to adjust the size of this ellipsoid, so that it matches your scene. This is the collision body, basically the size of the person walking around in the scene. Notice the yellow outline of an ellipsoid around the camera. The newly created first person shooter camera
