Jump to content

Slastraf

Developers
  • Posts

    705
  • Joined

  • Last visited

Everything posted by Slastraf

  1. function Script:Start() self.camera = Camera:Create() self.camera:Move(0,0,-4) local light = DirectionalLight:Create() light:SetRotation(-35,35,0) self.parent = nil self.parent2 = nil self.positionbetween= nil self.sprite = nil self.child = nil self.child2 = nil self.allignvector = Vec3 self.parent = Model:Box() self.parent:SetPosition(-2,0,0) self.parent:SetColor(1,1,1) self.parent:SetMass(0) self.parent:SetGravityMode(false) self.parent2 = Model:Box() self.parent2:SetPosition(2,0,0) self.parent2:SetColor(1,1,1) self.parent2:SetMass(0) self.parent2:SetGravityMode(false) self.positionbetween=Pivot:Create() self.child2 = Model:Box() self.child2:SetColor(0,0,1) self.child2:SetMass(1) self.child2:SetPosition(1,-1,0) self.child = Model:Box() self.child:SetColor(0,0,1) self.child:SetMass(1) self.child:SetPosition(-1,-1,0) self.sprite =Sprite:Create(self.child) self.sprite:SetSize(5,.1) local joint = Joint:Ball(-2,0,0, self.child, self.parent) local joint2 = Joint:Ball(0,0,0, self.child, self.child2) local joint2 = Joint:Ball(2,0,0, self.child2, self.parent2) end function Script:UpdatePhysics() self.positionbetween:SetPosition((self.parent:GetPosition()+self.child:GetPosition())/2) self.sprite:SetPosition(self.positionbetween:GetPosition()) self.allignvector=self.parent:GetPosition()-self.child:GetPosition() self.sprite:AlignToVector(self.allignvector:Normalize(),2) end My Idea here was that there were two white boxes that are the start and the end of the cable, and two boxes inbetween them that are the cable itself. So what is happening here ? I htink that the blue boxes itself are already kind of done, but my questions are: What is wrong with the sprite? How can I later optimize the script that I dont need to make all the cable parts by hand?-> for loop that makes as much boxes needed for a space between two white boxes?
  2. function Script:Start() self.camera = Camera:Create() self.camera:Move(0,0,-4) local light = DirectionalLight:Create() light:SetRotation(-35,35,0) local parent = nil local child = nil parent = Model:Box() parent:SetPosition(0,0,0) parent:SetColor(1,1,1) parent:SetMass(0) parent:SetGravityMode(false) child = Model:Box() child:SetColor(0,0,1) child:SetMass(1) child:SetPosition(2,0,0) child:AddTorque(0,0,0) local sprite =Sprite:Create(child) sprite:SetSize(5,.1) local joint = Joint:Ball(0,0,0, child, parent) end so how do you make a sprite connect / or look like connected between two points ? Also why is there added a force to the blue box ? i dont see it. When i put this script on a pivot in an empty scene the blue box begins to move
  3. Cables provide a simple method for adding movement and complexity to a scene for a relatively low cost. Cables can be strung between moving objects and used as a visual representation between physical constraints (springs, length constraints, etc). Cables can also dynamically be shaken or broken by level events. -> https://developer.valvesoftware.com/wiki/Cables_and_Ropes How do you make a script that automatically connects two pivots with ropes ? I taught of a billboard plane that is stretched so it looks like a rope with its textures, and connected as childs to bones that are as same as ragdolls.
  4. I need any tips or what ever you know about A good map / level design. -> picture related
  5. So what do we do now, private message did not work?
  6. make a terrain in blender: make a heightmap in blender to import it into leadwerks terrain (does not have not what you want by default) :
  7. so i was on the internet one day and saw some post about a darknet horror game that is one of the scariest out there. They say its so scary because of the sound they make, first I was also very uncomfortable but after some time I realised this was a sound from a youtube video :
  8. if you put the player movement into the updateworld instead of the updatephysics function, you experience a better performance, exspecially if you walk over a bluff landscape then it will look something like this --Player Movement local movex=0 local movez=0 self.input[0]=0 self.input[1]=0 if window:KeyDown(Key.W) then self.input[1]=self.input[1]+1 end if window:KeyDown(Key.S) then self.input[1]=self.input[1]-1 end if window:KeyDown(Key.D) then self.input[0]=self.input[0]+1 end if window:KeyDown(Key.A) then self.input[0]=self.input[0]-1 end local playerMovement = Vec3(0) playerMovement.x = self.input[0] * self.moveSpeed playerMovement.z = self.input[1] * self.moveSpeed --This prevents "speed hack" strafing due to lazy programming if self.input[0]~=0 and self.input[1]~=0 then playerMovement = playerMovement * 0.70710678 end --if self.entity:GetAirborne() then -- playerMovement = playerMovement * 0.2 --end --Check for running with shift and when not carrying anything if self.carryingEntity == nil and window:KeyDown(Key.Shift) then playerMovement.z = playerMovement.z * self.speedMultiplier end -- Check for jumping local jump = 0 if window:KeyHit(Key.Space) and self:IsAirborne() == 0 then jump = self.jumpForce self.sound.footsteps.concrete.jump:Play() if self.weapons[self.currentweaponindex]~=nil then self.weapons[self.currentweaponindex]:BeginJump() end --Give the player an extra boost when jumping playerMovement = playerMovement * 1.6 end -- Check for crouching --if App.window:KeyHit(Key.ControlKey) then -- crouched = not crouched --end --With smoothing --Position camera at correct height and playerPosition self.entity:SetInput(self.camRotation.y, playerMovement.z, playerMovement.x, jump , false, 1.0, 0.5, true) local playerPos = self.entity:GetPosition() local newCameraPos = self.camera:GetPosition() --local playerTempHeight = ((self:IsCrouched() == 1) and crouchHeight or playerHeight) newCameraPos = Vec3(playerPos.x, newCameraPos.y ,playerPos.z) if newCameraPos.y newCameraPos.y = Math:Curve(playerPos.y + self.eyeheight, newCameraPos.y, self.camSmoothing) else newCameraPos.y = playerPos.y + self.eyeheight end self.camera:SetPosition(newCameraPos) if self.isairborne==true then if self.entity:GetAirborne()==false then if self.weapons[self.currentweaponindex]~=nil then self.weapons[self.currentweaponindex]:BeginLand() end end end self.isairborne = self.entity:GetAirborne() --Mouse look self.currentMousePos = window:GetMousePosition() window:SetMousePosition(Math:Round(context:GetWidth()/2), Math:Round(context:GetHeight()/2)) self.currentMousePos.x = Math:Round(self.currentMousePos.x) self.currentMousePos.y = Math:Round(self.currentMousePos.y) if self.mousezpos==nil then self.mousezpos=0 end if self.currentMousePos.z~=self.mousezpos then if self.weapons[self.currentweaponindex] then if self.weapons[self.currentweaponindex].currentaction==nil then for n=1,math.abs(self.currentMousePos.z-self.mousezpos) do if self.currentMousePos.z>self.mousezpos then self:CycleWeapon(-1) else self:CycleWeapon(1) end end self.mousezpos=self.currentMousePos.z end else self.mousezpos=self.currentMousePos.z end end self.mouseDifference.x = Math:Curve(self.currentMousePos.x - Math:Round(context:GetWidth()/2),self.mouseDifference.x,3) self.mouseDifference.y = Math:Curve(self.currentMousePos.y - Math:Round(context:GetHeight()/2),self.mouseDifference.y,3) self.camRotation.x = Math:Clamp(self.camRotation.x + self.mouseDifference.y / self.mouseSensitivity,-50,50) self.camRotation.y = self.camRotation.y + (self.mouseDifference.x / self.mouseSensitivity) headrotationx = self.camRotation.x --Adjust the view shake self.hurtoffset.x = Math:Inc(0,self.hurtoffset.x,2*Time:GetSpeed()) self.hurtoffset.y = Math:Inc(0,self.hurtoffset.y,2*Time:GetSpeed()) self.smoothedhurtoffset.x = Math:Curve(self.hurtoffset.x,self.smoothedhurtoffset.x,3) self.smoothedhurtoffset.y = Math:Curve(self.hurtoffset.y,self.smoothedhurtoffset.y,3) --Set the camera angle self.camera:SetRotation(self.camRotation+self.smoothedhurtoffset) --Picking and usage local pickInfo = PickInfo() --Raycast Pick that is being send from the camera in to the world self.canUse = false local fire = false local currentime = Time:GetCurrent() if self.carryingEntity==nil then if self.weapons[self.currentweaponindex]~=nil then if self.weapons[self.currentweaponindex].automatic then if window:MouseDown(1) then fire=true else self.suspendfire=false end else if window:MouseHit(1) then fire=true end end end end --Fire weapon if self.carryingEntity==nil then if fire then if self.suspendfire~=true then if self.weapons[self.currentweaponindex].clipammo==0 and self.weapons[self.currentweaponindex].automatic==true then self.suspendfire=true end self.weapons[self.currentweaponindex]:Fire() end end end --Throw object if holding one if self.carryingEntity then if window:MouseHit(1) then local dir = Transform:Vector(0,0,self.throwforce,self.camera,nil) self.carryingEntity:AddForce(dir) self:DropEntityCarrying() end end if window:KeyHit(Key.R) then if self.weapons[self.currentweaponindex]~=nil then if type(self.weapons[self.currentweaponindex].CanReload)=="function" then if self.weapons[self.currentweaponindex]:CanReload() then self.suspendfire=false self.weapons[self.currentweaponindex]:Reload() end end end end if window:KeyHit(Key.E) then if self.carryingEntity then self:DropEntityCarrying() else local p0 = self.camera:GetPosition(true) local p1 = Transform:Point(0,0,self.useDistance,self.camera,nil) if self.entity.world:Pick(p0,p1, pickInfo, 0, true) then --Looks for any entity in the hierarchy that has a "Use" function local usableentity = self:FindUsableEntity(pickInfo.entity) if usableentity~=nil then --Use the object, whatever it may be usableentity.script:Use(self.entity) else if self.carryingEntity == nil then mass = pickInfo.entity:GetMass() --Pick up object if it isn't too heavy if mass>0 and mass<=self.maxcarryweight then self.carryingEntity = pickInfo.entity self.carryingobjectcollisiontype = self.carryingEntity:GetCollisionType() self.carryingEntity:SetCollisionType(Collision.Debris) self.carryrotation = Transform:Rotation(pickInfo.entity:GetQuaternion(true),nil,self.camera) self.carryposition = Transform:Point(pickInfo.entity:GetPosition(true),nil,self.camera) end end end end end end --The icon that shows that an object can be picked up or can be interacted with --Amnesia fan, I see. if self.carryingEntity == nil then local p0 = self.camera:GetPosition(true) local p1 = Transform:Point(0,0,self.useDistance,self.camera,nil) if self.entity.world:Pick(p0,p1, pickInfo, 0, true) then if self:FindUsableEntity(pickInfo.entity)~=nil then self.canUse=true else local mass = pickInfo.entity:GetMass() if mass>0 and mass<=self.maxcarryweight then self.canUse = true end end end end
  9. thanks, got into some trouble with that when I tried to make my character hurt to death when he has no oxygen or hunger left.
  10. i taught of this : get all positions of all entities as a vec3 and then check for x and z . if those are equalling under (for example 10) then add a new random value to the spawning point. all this before a new monster gets spawned and make sure the things above get checked as often as if there isnt an other entity around.
  11. oh yeah, the navigation mode was it. I have put them both in start function and updatephysics but not like that
  12. I dont know what I am doing wrong, or if this is a bug. function Script:Start() end function Script:UpdatePhysics() self.entity:SetNavigationMode(true) self.entity:GoToPoint(100,0,100,1.4,1) end This script is attached to the prefab crawler. Inside the Game the crawler floats in mid air doing nothing, collision but no physics work. I have tried this in an other game with this, http://www.leadwerks.com/werkspace/page/tutorials_legacy/_/script/waypoints-and-simple-ai-r120 It is doing the same thing PS: the usual monstarAi script works fine
  13. chrisv , I am very happy and thankful that you are really working on the texture pack. I will definetly credit your work and look forward to some updates. Maybe make a few more flatland (sandy) textures for different surroundings ?
  14. thirsty panther, this is going to be a little bit like far cry, there will be landing places and smaller abandoned alien cities where you can find some things that affect the gameplay like snipers , small oxygen tanks which need to be filtered. and also a few kinds of aliens can be found in those spaceship landing places. the player can navigate trough the map by following pipelines.
  15. also always try to use box shapes or sphere shapes (or convex hull) but I would not recommend a poly mesh physics shape. They are very glitchy in my games, usually they dont have gravity enabled (when I use them)
  16. I have made this Blog in a Video. Feel free to check it out
  17. Simpliest way to do this is : 1. make a new map that is loaded at program start 2. set it up how you want it 3. when space is pressed, load the (real) first map
  18. double click on it and then go to physics option
  19. local windowstyle = window.Fullscreen --edited here choose between Fullscreen and Titlebar if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+window.FullScreen end window=Window:Create(title,0,0,System:GetProperty("screenwidth","1920"),System:GetProperty("screenheight","1080"),windowstyle) window:HideMouse() That line in the main.lua script or app.lua ( which you have got) should do it it is under the line "--create a window"
  20. your characters back needs to be rotated facing the z axis ( the blue axis) , also make sure that the physics settings are all right . exspecially take a look at the character angle, you insert 180.0 there so that everything works fine when you rotate it like this.
  21. I can not explain it very good, so here I found a random metro video: Notice here the fuzz around the corners of the screen.. There is the broken glass overlay somwhere in the mid that is noticed and the fuzz in the corners. Can this both be somehow done with the overlay or does the fuzz need a shader?
  22. A thing like the screenshot of cs;s graphics test combined with a overlay, that makes it visible inside the game only where the ovelay is visible, too. (look at the very top)
  23. yeah thats why I would want to see that as a shader in leadwerks
  24. I finished that just now, but they are just the 2d Images that dont interact with the world. What would be nice to see is a thing like that : http://techreport.com/r.x/source-engine/multiple-effects.jpg So it looks like there is freezed water or smoke onthe glass and rain things
×
×
  • Create New...