Jump to content

making a cockpit

Recommended Posts



I am interested in doing a cockpit for a space type game.


I will create a model in 3DS max or blender, I am just wondering how to attach it to the first person camera in LUA, would it be a similar process as adding a HUD but not with the Draw command.


What I want to do is have clickable objects in the cockpit etc etc as well but that looks like it is the easy part lol...


I would use C++ but I am not comfortable enough with it yet so I would prefer to use LUA...


any help, I would be thank full for it..

Share this post

Link to post

I think in the Scene tab you can drag the cockpit under the camera (or vice versa), to make it a child. Then when you move the camera around, the cockpit will follow.


In Lua, you might use something like a SetParent command.

Share this post

Link to post

If you want to move your camera freely around the cockpit, then you load the model of the cockpit/place it in the scene. However do not parent it, since you can't move the mouse to press any buttons. If freelook is not needed, then you can parent it.

  1. Load/place the model.
  2. have a camera that contains a script with the camera rotation.
  3. in the same script you can use raycast to detect other objects that are part of the cockpit.
  4. If you want to move the cockpit, then the cockpit should have its own script

Share this post

Link to post

the cockpit is more a sphere where u put the camera in.

i would memory the cam in the sphere script as property.

if it set if self.cam ~= nil then self:SetCamToCokpit(self.cam) end

at top Sphere script

Script.cam = nil --entity "Used Cam"

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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