Hi Robin,
I just zipped up the project folder, if it doesn't work then I'm ?
Here's a modification to the jump so you you can only jump when one the ground...
function Script:Start()
camera=Camera:Create()
camera:SetParent(self.entity)
camera:SetPosition(0,1.5,0)
camera:SetRotation(0,0,0)
self.camerarotation=Vec3(0)
self.rot=0.0
self.move=0.0
self.strafe=0.0
self.jump=0.0
self.crouch=false
self.mouseposition=Vec2(0,0)
self.movement=Vec3(0,0,0)
self.movespeed=5
self.lookhspeed=0.5
self.lookvspeed=0.75
self.movesmoothing=8
self.looksmoothing=5
self.moveforce=Vec3()
self.mouseposition=Vec2()
self.mousespeed=Vec2()
self.mouseinvert=-1
end
--[[
function Script:UpdateMatrix()
end
]]--
--[[
function Script:UpdateWorld()
end
]]--
function Script:UpdatePhysics()
local window = Window:GetCurrent()
local cx=window:GetClientWidth()/2
local cy=window:GetClientHeight()/2
local camerarotation = camera:GetRotation()
local mousepos=window:GetMousePosition()
window:SetMousePosition(cx,cy)
self.mousespeed.x = Math:Curve(mousepos.x-cx,self.mousespeed.x,self.looksmoothing)*Time:GetSpeed()
self.mousespeed.y = Math:Curve(mousepos.y-cy,self.mousespeed.y,self.looksmoothing)*Time:GetSpeed()
camerarotation.x = camerarotation.x+(self.mouseinvert*self.mousespeed.y)*self.lookvspeed
if camerarotation.x>80 then camerarotation.x=80 end
if camerarotation.x<-80 then camerarotation.x=-80 end
camera:SetRotation(camerarotation)
self.rot=self.rot+self.mousespeed.x*self.lookhspeed
if (window:KeyDown(Key.W)) then self.move=self.movespeed*Time:GetSpeed() end
if (window:KeyDown(Key.S)) then self.move=-(self.movespeed/2)*Time:GetSpeed() end
if (window:KeyDown(Key.D)) then self.strafe=-self.movespeed*Time:GetSpeed() end
if (window:KeyDown(Key.A)) then self.strafe=self.movespeed*Time:GetSpeed() end
if (window:KeyHit(Key.Space)) then
if not self.entity:GetAirborne() then
self.jump=10.0
end
end
self.entity:SetInput(self.rot,self.move,self.strafe,self.jump)
self.move=self.move*0.9
self.strafe=self.strafe*0.9
self.jump=0.0
end
--[[
function Script:Collision(entity, position, normal, speed)
end
]]--
--[[
function Script:Draw()
end
]]--
--[[
function Script:DrawEach(camera)
end
]]--
--[[
function Script:Release()
end
]]--
--[[
function Script:Cleanup()
end
]]--