-
Posts
3,946 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by macklebee
-
I would assume its just a script using entity:GoToPoint() and camera:Pick()? example: window = Window:Create("example",0,0,800,600) context = Context:Create(window) world = World:Create() local camera = Camera:Create() camera:SetRotation(45,0,0) camera:Move(0,0,-8) local light = DirectionalLight:Create() light:SetRotation(35,35,0) camera:SetDebugNavigationMode(true) local ground = Model:Box(10,1,10) ground:SetPosition(0,-0.5,0) ground:SetColor(0.0,0.25,0.0) local shape = Shape:Box(0,0,0, 0,0,0, 10,1,10) ground:SetShape(shape) shape:Release() entity = Model:Box(1,1,3) entity:SetColor(0.0,0.0,1.0) entity:SetPosition(0,0.5,0) local shape = Shape:Box(0,0,0,0,0,0,1,1,3) entity:SetShape(shape) shape:Release() ground:SetNavigationMode(true) entity:SetNavigationMode(true) world:BuildNavMesh() player = Pivot:Create() local visiblecapsule = Model:Cylinder(16,player) visiblecapsule:SetScale(1,2,1) visiblecapsule:SetPosition(0,1,0) player:SetPosition(-4,0,0) player:SetMass(1) player:SetPhysicsMode(Entity.CharacterPhysics) while window:KeyHit(Key.Escape)==false do if window:Closed() then break end if window:MouseHit(1) then local pickinfo = PickInfo() local p = window:GetMousePosition() if camera:Pick(p.x,p.y,pickinfo,0,true) then System:Print(pickinfo.position:ToString()) player:GoToPoint(pickinfo.position,1.4,1) end end Time:Update() world:Update() world:Render() context:Sync(true) end
-
It works for me just fine. Did you drag an entity from the Scene panel into the Script's property panel? And the Script:UpdateWorld() is not blue. Script.spawnObject = "" --entity "spawn object" Script.spawnTime= 1.0 --float "Spawn time" Script.timer = 0 function Script:UpdateWorld() self.timer = self.timer + (Time:GetSpeed()/100) if(self.timer > self.spawnTime) then local newObject = self.spawnObject:Instance() newObject:SetPosition(self.entity:GetPosition()) self.timer = 0 end end function Script:PostRender(context) context:SetBlendMode(1) context:DrawText("Timer: "..self.timer,2,142) context:SetBlendMode(0) end
-
Also, Script.timer should initially be set to 0 not nil or it will fail to add in the Script:UpdateWorld() function. Also, in the Script:UpdateWorld() function, using 'self.timer = 0' is the same as using 'Script.timer = 0' due to self = Script inside that function. Suggest you go through the lua Tutorials located at the bottom of the tutorial page: http://www.leadwerks.com/werkspace/page/tutorials/
-
As far as shadow map resolutions, you used to be able to change that in LE2 in lua but it doesn't appeared to be exposed to lua for LE3/4. I assume its tied to the light quality now but thats just a guess on my part. If its an option in c++, then you will have to change the shadow map size there.
-
newObject:SetPosition(self.entity:GetPosition {)} should be a '(' not a '{'
-
You can change the shadow quality via lua by World:SetLightQuality() but the issue shown in your previous posts is due to the shadow offset at different shadow stages/ranges. Back in the LE2 and 3DWS days, you could overcome this by putting a chamfer on the edges of enclosed box, making the walls & ceiling thicker, and worse case changing the directional light stage's shadow offset. You can still do all the above in LE3 though they are not really documented. You have to figure out which stage is causing the problem and adjust it's linear offset value. Use the range value as a way to determine which stage where the light leaks through. The directional light has 4 stages with the following ranges and offsets: - Stage0: Range: 6m Offset: 0.100000, 1.000000 (linear offset, exponential offset) - Stage1 Range: 15m Offset: 0.200000, 1.000000 - Stage2 Range: 30m Offset: 0.500000, 1.000000 - Stage3 Range: 80m Offset: 0.750000, 1.000000 I would suggest only changing these values as a last attempt if you cannot resolve the issue via modeling as changing these could cause other artifacts and lighting problems in the rest of your scene. Example script to attach to the directional light for determining which stage needs to be adjust and to what value: function Script:Start() self.stage = 0 self.offset = {} self.range = {} for i = 0, 3 do self.offset = self.entity:GetShadowOffset(i) System:Print("Stage"..i.." Offset: "..self.offset:ToString()) self.range = self.entity.shadowstagerange System:Print("Stage"..i.." Range: "..self.range) end end function Script:UpdateWorld() window = Window:GetCurrent() if window:KeyHit(Key.Right) then self.stage = self.stage + 1 end if window:KeyHit(Key.Left) then self.stage = self.stage - 1 end self.stage = math.max(self.stage, 0) self.stage = math.min(self.stage, 3) if window:KeyHit(Key.Up) then self.offset[self.stage].x = self.offset[self.stage].x + 0.1 end if window:KeyHit(Key.Down) then self.offset[self.stage].x = self.offset[self.stage].x - 0.1 end self.entity:SetShadowOffset(self.offset[self.stage].x, self.offset[self.stage].y, self.stage) end function Script:PostRender(context) context:SetBlendMode(Blend.Alpha) context:SetColor(1,1,1,1) context:DrawText("Hit Left/Right Arrow Keys To Change Stages",2,22) context:DrawText("Hit Up/Down Arrow Keys To Change Stage's Linear Offset",2,42) context:DrawText("Stage: "..self.stage,2,62) context:DrawText("Range: "..self.range[self.stage],2,82) context:DrawText("Offset: "..self.offset[self.stage]:ToString(),2,102) context:SetBlendMode(Blend.Solid) end
-
not quite sure what the issue is as that code has worked and works now for me.
-
It is possible and crouch does work but there are some caveats. It appears crouch height is 1.2 meters and the debug physics body does not change size at least visually when crouched. example: window = Window:Create("crouch height",0,0,800,600) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:SetRotation(40,0,0) camera:Move(0,0,-8) light = DirectionalLight:Create() light:SetRotation(35,35,0) camera:SetDebugPhysicsMode(true) ground = Model:Box(10,1,10) ground:SetPosition(0,-0.5,0) ground:SetColor(0,1,0) shape = Shape:Box(0,0,0, 0,0,0, 10,1,10) ground:SetShape(shape) shape:Release() box1 = Model:Box(1,1.2,1) box1:SetPosition(-2,0.6,-1) box2 = Model:Box(1,1.2,1) box2:SetPosition(2,0.6,-1) box3 = Model:Box(5,1,1) box3:SetPosition(0,1.7,-1) shape = Shape:PolyMesh((box1:GetSurface(0))) box1:SetShape(shape) shape = Shape:PolyMesh((box2:GetSurface(0))) box2:SetShape(shape) shape = Shape:PolyMesh((box3:GetSurface(0))) box3:SetShape(shape) shape:Release() player = Pivot:Create() visiblecapsule = Model:Cylinder(16,player) visiblecapsule:SetScale(.8,1.8,.8) visiblecapsule:SetPosition(0,.9,0) player:SetPosition(-4,0,0) player:SetMass(1) player:SetPhysicsMode(Entity.CharacterPhysics) crouch = false while window:KeyHit(Key.Escape)==false do if window:Closed() then break end move = ((window:KeyDown(Key.W) and 1 or 0) - (window:KeyDown(Key.S) and 1 or 0))*4 strafe = ((window:KeyDown(Key.D)and 1 or 0) - (window:KeyDown(Key.A) and 1 or 0))*4 jump = (window:KeyHit(Key.Space) and 1 or 0)*8 if window:KeyHit(Key.C) then crouch = not crouch end player:SetInput(0,move,strafe,jump,crouch) Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:DrawText("Crouched: "..tostring(crouch),2,2) context:SetBlendMode(Blend.Solid) context:Sync() end Also note this example shows that when crouching under something, the developer needs to prevent standing back up to prevent weird physic results from occurring - ie character slingshot across map, character pushed through the map, etc...
-
Beta Branch: Nav Mesh doesn't build.
macklebee replied to reepblue's topic in Leadwerks Engine Bug Reports
It seems to be able to build navmesh for terrain and via scripted code, but not for CSG created objects at least in windows, -
Shouldn't that make you pause when you see that? Its 32MBs because of the WAV format - if that was OGG, it would probably be 1/4 of that if not less and still have the same sound quality.
-
so try putting those textures and the mat into your project and see if it resolves it
-
I am using windows 7 and all I get is a black screen that I have to forced to close. The log shows multiple errors: Error: Failed to load texture "C:/Program Files (x86)/Steam/steamapps/common/Leadwerks Game Launcher/prefabs/statue/FuseModel_Body_diffuse.tex" Error: Failed to load texture "C:/Program Files (x86)/Steam/steamapps/common/Leadwerks Game Launcher/prefabs/statue/FuseModel_Body_normal.tex" Error: Failed to load texture "C:/Program Files (x86)/Steam/steamapps/common/Leadwerks Game Launcher/prefabs/statue/FuseModel_Body_specular.tex" then ~100s of the same error: Error: Failed to load material "C:/Program Files (x86)/Steam/steamapps/common/Leadwerks Game Launcher/Materials/Common/NavMesh.mat". ^^I cannot imagine this is doing you any favors
-
http://www.leadwerks.com/werkspace/page/api-reference/_/window/windowflushmouse-r904
-
Perform the same steps as shown here: http://www.leadwerks.com/werkspace/topic/11423-deleted-the-object-search-window-on-the-right/#entry82646
-
martyj is correct - LE needs key framed animated bones. Your modeling program probably has the ability to perform that. If not, then you can use something like Ultimate Unwrap 3D that will convert those to key framed animations for the bones, as shown in the attachment: vento_animated.FBX But your model leaves a lot to be desired. Each component is a separate submesh resulting in ~90 meshes in this one model. The only things moving are cylinder 6 & cylinder 7. So the engine will need to iterate through all 90+ meshes for rendering/animating.I would suggest trying one of two ways to make this model: 1) Collapsing the model in your modeling program so that every thing other than two rotating cylinders are one mesh and just animate the two cylinders only 2) Collapse the base into just one model and the two cylinders into separate models. Do not use animation at all and just combine the parts using a lua script. In the lua script, also perform the rotation of the two cylinders.
-
Disable vegetation shadow option by default.
macklebee replied to Crazycarpet's topic in Suggestion Box
For me, the only default that is selected in vegetation painting is the use of billboards. Shadows are off by default, as well as collision. -
Looking pretty good. I am getting a lot of flashing as well on various things: - When the checkbox is checked/unchecked, the text "Checkbox" flashes - I assume its redrawing everything associated with the checkbox? - The list is flashing when scrolling - The textbox flashes when adding new letters - Everything flashes when window resizes
-
not quite sure what you are asking for? Shadmar did a dissolve shader and maybe that is what you are referring to? http://www.leadwerks.com/werkspace/topic/12091-dissolve-shader/#entry87801
-
It already does random sizes on the vegetation when painting them onto the terrain? Maybe I am not understanding what you are asking for?
-
Look at Character Angle setting in the physics properties panel: http://www.leadwerks.com/werkspace/page/tutorials/_/scene-panel-r3#section2.3
- 1 reply
-
- 1
-
Syntax is wrong. should be: distance = entity1:GetDistance(entity2) http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitygetdistance-r800
-
LE2 had a vegetation tool. LE3 was a rewritten engine and did not have vegetation implemented at one time. If the demo is missing this, then I suspect Josh has not updated the demo in a long time.
-
The terrain should be scene. You want the player to collide with the wall. And you want the stones to collide with the scene and with each other but not the wall. So you can either make the stones a custom collision type/response or you can make the wall a custom collision type/response. example: window = Window:Create("example",0,0,800,600,257) context = Context:Create(window) world = World:Create() light = DirectionalLight:Create() light:SetRotation(35,45,0) camera = Camera:Create() camera:SetMultisampleMode(2) camera:SetPosition(0,4,-4) ground = Model:Box() ground:SetScale(10,1,10) ground:SetColor(0.1,1,0.3) shape = Shape:Box(0,0,0, 0,0,0, 10,1,10) ground:SetShape(shape) ground:SetCollisionType(Collision.Scene) wall = Model:Box() wall:SetPosition(-2,3,0) wall:SetScale(2,.1,2) wall:SetColor(1,1,0) shape = Shape:Box(0,0,0, 0,0,0, 2,.1,2) wall:SetShape(shape) wall:SetCollisionType(Collision.Prop) Collision.Custom = 10 Collision:SetResponse(Collision.Custom,Collision.Custom,Collision.Collide) Collision:SetResponse(Collision.Custom,Collision.Scene,Collision.Collide) wall = Model:Box() wall:SetPosition(2,3,0) wall:SetScale(2,.1,2) wall:SetColor(1,1,0) shape = Shape:Box(0,0,0, 0,0,0, 2,.1,2) wall:SetShape(shape) wall:SetCollisionType(Collision.Custom) ball1 = Model:Sphere(16) ball1:SetColor(1,0,0) shape = Shape:Sphere(0,0,0, 0,0,0, 1,1,1) ball1:SetShape(shape) ball1:SetMass(1) ball1:SetPosition(-2,10,0) ball1:SetCollisionType(Collision.Custom) ball2 = Model:Sphere(16) ball2:SetColor(1,0,1) shape = Shape:Sphere(0,0,0, 0,0,0, 1,1,1) ball2:SetShape(shape) ball2:SetMass(1) ball2:SetPosition(2,10,0) ball2:SetCollisionType(Collision.Custom) while not window:KeyHit(Key.Escape) do if window:Closed() then return false end Time:Update() world:Update() world:Render() context:Sync(true) end
-
http://www.leadwerks.com/werkspace/page/api-reference/_/command-reference/collision-r778 and to add your own collision types and responses: http://www.leadwerks.com/werkspace/topic/11744-defining-new-collision-constantstypes/#entry84834
-
LE2 had the projected textures for spotlights - refer to the old example with the flashlight. During a couple of hangouts, I have requested this feature and transparent colored shadows in LE3/4.