Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

awesome. Thanks Rick. I will learn a thing or three from this. now I just need to get my characters converted to gmf's, so I can start playing with it. :rolleyes:

AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD

76561197984667096.png

Posted

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.

Posted

do you position lock your before you do that? I can't seem to get it to hold on to the object without moving it..

 

THats how I thought it worked, I just was having a little issues.

AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD

76561197984667096.png

Posted

I didn't need to position lock. I do know what you are talking about, but you just have to make sure your cursor doesn't change to indicate it's going to move the object. I guess I don't have much of an issue doing it though.

  • 1 year later...
Posted

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

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.

×
×
  • Create New...