Jump to content

Recommended Posts

Posted

I'm more an artist than a coder and was looking at the FPS Script to get a rough idea but can't figure out how to control a spacecraft.

 

Basically :

 

orbit around the spacecraft on key toggle

 

W - accelerate

S - slow down / backward

A / D - roll

Mouse - yaw / pitch

 

with zero gravity

 

If there is already a tutorial that I missed (YouTube ?) let me know, otherwise any help most welcome

Posted

u need from Window class :KeyDown(Key.A)

and for self.entity:

any movement functions or maybe physics.

zero gravity with physics :SetGravityMode(false)

 

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/

 

non physics

with Translate u can put it up and down,forwand & backwards, left & right

with Turn pitch, yaw and roll

 

not global = local means along/around the objext axis x,y,z.

PC : Win 10 Pro 64 Bit , 4x cores ~2 GHz , 8 GB RAM , AMD R7 265

2D : Photoline , Zooner Photo Studio 13 , Art Rage Studio 3.5.4 , Ashampoo Snap 7 , ...

3D : Shade 15 Basic , Carrara 8.5 & DAZ Studio 4.8 , Cheetah 3D 6.3.2 , Via Cad 8

Music : Samplitude Music Studio , Music Creator 7

IDE : Leadwerks Engine 3.x , Unity 5.x , (Unreal 4.8.x) , AGK v2.x , Construct 2 , (Clickteam Fusion 2.5) , ShiVa 1.9 , Game Maker Studio , MS Visual Studio .Net , Android Studio , Monkey , ...

Posted

From one of my projects called Lunar lander, very simple but easy to adapt and add more.

 

Give you model Character controller and some mass.

 


function Script:Start()
 self.entity:SetGravityMode(false)
  self.rot = Vec3(0,0,0)
self.input = 0   
end

function Script:UpdatePhysics()


local v = self.entity:GetVelocity()
local turnspeed=1

if v.y <= 4 then
  if (App.window:KeyDown(Key.Space)) then self.entity:AddForce(0,0.5*Time:GetSpeed(),0)
  else if v.y >= -1 then self.entity:AddForce(0,-0.05*Time:GetSpeed(),0) end
  end
end

if (App.window:KeyDown(Key.W)) then self.input = 0.5 end
if (App.window:KeyDown(Key.S)) then self.input = -0.5 end
if (App.window:KeyDown(Key.Q)) then self.rot.y=self.rot.y-turnspeed*Time:GetSpeed() end 
if (App.window:KeyDown(Key.E)) then self.rot.y=self.rot.y+turnspeed*Time:GetSpeed() end

self.entity:SetInput(self.rot.y,0,self.input,0,false,1)

end

Elite Cobra Squad

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