Jump to content
  • entries
    2
  • comments
    14
  • views
    9,138

Setting up a map with 3rd person controls and camera


Chris Vossen

8,772 views

 Share

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

 

blogentry-5181-0-13427300-1362705593_thumb.png

 

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.

 

blogentry-5181-0-80226900-1362705911_thumb.png

 

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.

 

blogentry-5181-0-18567000-1362706239_thumb.png

 

 

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.

 

blogentry-5181-0-92892300-1362706088_thumb.png

 

blogentry-5181-0-65987700-1362706098_thumb.png

 

 

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.

 

blogentry-5181-0-05647500-1362706347_thumb.png

 

 

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.

 

blogentry-5181-0-75977600-1362706453_thumb.png

 

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)

 

blogentry-5181-0-70790700-1362706704_thumb.png

 

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).

 

blogentry-5181-0-12016100-1362706738_thumb.png

 

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"

 

blogentry-5181-0-24126800-1362706849_thumb.png

 

Browse to the 3rdPersonMovements.Lua and click okay

 

blogentry-5181-0-42306900-1362707187_thumb.png

 

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.

 

blogentry-5181-0-57456200-1362707434_thumb.png

 

13. Click run

 

On the tool bar click on the run icon, or Game->Run, or press F6 on your keyboard.

 

blogentry-5181-0-54611600-1362707513_thumb.png

 

 

14. Run around!

 

Using the W and S keys move the goblin forward and backward or rotate with the A and D keys.

  • Upvote 1
 Share

10 Comments


Recommended Comments

These are great but can we get them in an organized location for future use? Having them spread around in blogs and posts isn't ideal.

Link to comment

@ Rick:

 

Yeah I noticed the problem that after posting 2 "tutorials" the first one become hard to find.

 

Right now the things I am posting are super rough so there is no "Official tutorial" section. But I would like an official tutorials section in the future. But currently there is not enough time.

 

@Shadmar

Video tutorials always sound like a good idea, but I always find myself having to rewind, or pause the video and you can't copy and paste stuff. I think ideally a combination of a video tutorial and a written tutorial would be awesome. (But the amount of time to produce quality tutorials would skyrocket)

Link to comment

Same question from me as from Serginho, I don't have the "Add Script" option either. I can select the Goblin object and set the 3rdPersonMovements.Lua script in the "script" tab down a the bottom, but then how do I "add" the AnimationManager.lua script as well?

Link to comment

I have the Darkness Awaits Model Pack, for the Goblin Character etc. but how do I get a hold of the full Darkness Awaits Game Demo that I can pull part to see how the various things are done? The only demo of this game that I can find in the workshop has the resource files in a password protected ZIP.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...