Setting up a map with 3rd person controls and camera
A tutorial for creating map with a goblin that has third person controls and a third person camera
1. Create a new project.
Inside the LE3 editor open up the leadwerks project manager click File->Project Manager
Once open click "new" select "Lua" project, add a title, and click "Ok".
Select your newly created project and click "Ok"
2. Create a platform for the goblin to stand on.
In a 2d viewport drag-out a box to be used as a platform.
3. Add a material to the platform.
In the assest browser open up the material->developer folder and drag and drop bluegrid.mat onto the platform.
4. Add the goblin model from Darkness Awaits to the new project.
Using your file browser navigate to the Darkness Awaits goblin model folder (C:\Leadwerks\Projects\DarknessAwaits\Models\Characters) and copy the goblin folder into your new project.
5. Drag and drop the goblin into the map
In the asset browser open up models->goblin. Click on the goblin.mdl icon and drag it into the scene.
6. Set the goblins position and rename it
In the Scene browser select SKIN_MESH and change its position to 0,0,0 and change the name to Goblin.
7. Setup the goblin's physics properties
With the goblin still selected in the scene browser, click on the Physics tab.
Change Physics Mode to "Character Controller"
Mass to 1.0
Collision Type to "Character"
Character Rotation to 180. (The default model facing is towards the positive Z axis, the goblin model was created facing the negative z axis so you have to rotate the character controller to match the model)
8. Add in a camera
In the Object browser select Miscellaneous for object and camera for type. Click in a 2d viewport and click Create (or hit enter).
9. Download Scripts
Download the 3rdPersonMovements.Lua and 3rdPersonCamera.Lua
http://www.leadwerks...-person-camera/
http://www.leadwerks...erson-controls/
Save these files into your projects script folder (or drag and drop into the asset browser)
10. Attach Scripts to goblin.
In the Scene browser, right click on the goblin and select "Add Script"
Browse to the 3rdPersonMovements.Lua and click okay
Once again right click on the goblin, select "Add Script" and in the Scripts/Animations folder select AnimationManager.lua
11. Attach Scripts to camera.
In the Scene browser, right click on the camera and select "Add Script"
Browse to 3rdPersonCamera.Lua and click okay.
12. Setup the 3rd Person Camera target.
In the scene browser, left click on camera then click on the 3rdpersoncamera tab.
now drag and drop the goblin into the camera's target field.
13. Click run
On the tool bar click on the run icon, or Game->Run, or press F6 on your keyboard.
14. Run around!
Using the W and S keys move the goblin forward and backward or rotate with the A and D keys.
- 1
10 Comments
Recommended Comments