Jump to content

Shambler

Members
  • Posts

    21
  • Joined

  • Last visited

Everything posted by Shambler

  1. It all looks very real apart from the bench. I think detailed grass could be done with a shader just like you can do fur with a fur shader.
  2. 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 ]]--
  3. Ok peeps, here is some sample code for an FPS camera...think of it at as a work in progress since there are a couple of things not quite right but it should give people some idea of where to start. Things that work movement back and forwards,mouselook including limiting up/down angle, collision and jumping. Things that aren't great 1) Strafe does not work as expected...does not rotate with the controller...I think someone else has this issue. 2) Crouch would not work so I took it out. 3) Camera moves around wildly for the first second until it stabilises...probably an easy fix but I've got to go out! =) At least the code below should give us a foundation with which to get an fps controller up and running with input from everyone for bug fixes.
  4. Cameras could also benefit from this too.
  5. http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/window/windowmousehit-r457
  6. The camera does not appear to inherit the near/far settings in the editor. Adding a script to the camera function Script:Start() self.entity:SetRange(0.01,1000.0) end produces the expected result of clipping/not clipping close geometry, but altering the near/far in the editor does not. http://www.leadwerks...amera-clipping/
  7. Confirmed, a way around it is to attach a script to the camera and then function Script:Start() self.entity:SetRange(0.01,1000.0) end
  8. I prefer the 3DWS way in that it just goes ahead and creates the primitive as soon as you let go of the left mouse button. Every click or keypress saved adds to the fluidity of creation. I must say that I am loving the much tighter integration of LE3 over LE2.
  9. There does not appear to be a texture lock option, only angle lock.
  10. I am interested! I work as an electrical/electronics engineer so I know how to test things are foolproof
  11. I suppose it depends on the type of game. If the player has attributes which are carried through each level, e.g. fps or rpg, then you might want to preserve the player entity,controller and other stats in a single object and delete everything else. If the player starts from scratch each level, e.g. magic carpet, then you could just delete everything and start afresh each level by loading a new scene/terrain etc. and creating a new player. If the new level uses a different terrain than the last then ditch the terrain otherwise keep it in memory to save loading it again. This could also involve all assets for maximum speed of level loading. i.e. Tag all assets to be deleted... Parse through all of the assets needed by the new level ( or the save game you want to load )... If you find a currently loaded asset you need in the new level then reposition it and unmark it for deletion... If you don't find the asset then load it from disk... Once you have completed building the new level delete all assets which are still marked for deletion.
×
×
  • Create New...