Jump to content

Pi-3rdPersonCamera v 0.1


Rick
 Share

Recommended Posts

File Name: Pi-3rdPersonCamera v 0.1

File Submitter: Rick

File Submitted: 01 Jan 2010

File Category: Lua Scripts

 

Here is a very basic 3rd person camera thingoid. Just drag it into your scene and give it a target. The game script that you need to run also is:

 

require("Scripts/constants/collision_const")
require("Scripts/constants/engine_const")
require("Scripts/LinkedList")
require("Scripts/filesystem")
require("Scripts/math/math")



if fw==nil then --we are not in Editor
       RegisterAbstractPath("")
       Graphics(800,600)		-- need a better way to get screen res
       fw=CreateFramework()
       scene=LoadScene("")		-- need a way to get a scene to load
       scene:SetCollisionType(COLLISION_SCENE)
       TFilter(1)
       AFilter(4)
end

-- set globals
SetGlobalString("mode", "GAME_MODE")
SetGlobalString("quit", "false")

FlushKeys()
FlushMouse()


--main function
while (KeyHit(KEY_ESCAPE) == 0) and (GetGlobalString("quit") == "false") do

       fw:Update()
       fw:Render()
       Flip(0)
end

-- reset values
SetGlobalString("mode", "DESIGN_MODE")
SetGlobalString("quit", "false")

 

Click here to download this file

 

 

Will be creating a video that shows 3 of my Thingoids working together.

Link to comment
Share on other sites

It's actually just a camera that you can rotate around anything you give it as a target when you enter game mode given you are using the game script I posted above. It also has an offset setting. When you give it a target you'll see a white box. That white box is where the camera will point to. It'll start at the origin of the target, but you can offset it.

 

Also you rotate with holding down the left mouse button and moving the mouse.

 

I'm uploading a video right now that shows 3 controls, this being one, that allow you to get a quick moving 3rd person style player going in about a few mins. It's still very early and any ideas/help is welcome. The video and Thingoids should be up within an hour or so.

Link to comment
Share on other sites

To make a link you left click and hold on one object, and then drag it to another object. Just make sure you are dragging to the 2d images because that's the object. When working with the character object it can be confusing because it won't work if you drag to your model.

Link to comment
Share on other sites

  • 1 year later...

Hello Rick

I would use this principle followed by the camera, I know how to create a Link Dynamics bypassing the sandbox and LUA and how do the equivalent of SetGlobalString (), I'll assume it is with the function lua_setglobal, but I do not know how it works.

 

Thank you for your help

 

Gabriel

 

PS: for the C + + code

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

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

 Share

×
×
  • Create New...