-
Posts
3,946 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by macklebee
-
Toggle Fullscreen using Window:SetLayout()
macklebee replied to Haydenmango's topic in Suggestion Box
I am able to toggle fullscreen mode using SetLayout when I set the window style to '0' upon creation. It would be nice to be able to set the window styles between the two states though. What I haven't figured out what to do yet though is to change resolutions but be at fullscreen along with keeping the ability to go to a windowed mode. I think the missing ability to set the window style is the problem. count = System:CountGraphicsModes() resolutions = {} for i = 0, count-1 do resolutions = System:GetGraphicsMode(i) end window = Window:Create("window properties", 0,0,800,600,0) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:Move(0,0,-3) light = DirectionalLight:Create() light:SetRotation(35,35,0) model = Model:Box() model:SetColor(1.0,0.5,0.0) while window:KeyDown(Key.Escape)==false do if window:Closed() then break end if window:KeyHit(Key.Down) then window:SetLayout(0,0,800,600) end if window:KeyHit(Key.Up) then window:SetLayout(0,0,resolutions[count-1].x,resolutions[count-1].y) end model:Turn(0,Time:GetSpeed(),0) Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:DrawStats(0,0,true) context:Sync(true) end -
Terrain - how to access it from Lua code? + make it cast shadows?
macklebee replied to Lunarovich's topic in Programming
Also, the terrain commands (not supported/documented) are exposed to lua. example Main.lua: window = Window:Create("terrain example",0,0,800,600) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:SetPosition(0,6,0) camera:SetRotation(0,45,0) camera:SetMultisampleMode(8) skybox = Texture:Load("Materials/Sky/skybox_texture.tex") camera:SetSkybox(skybox) light = DirectionalLight:Create() light:SetRotation(45,45,0) terrain = Terrain:Create(128,true) terrain:SetLayerTexture(0, Texture:Load("Materials/Nature/terrain_savannah_dirt.tex"), 0) terrain:SetLayerTexture(0, Texture:Load("Materials/Nature/terrain_savannah_dirtdot3.tex"), 1) terrain:SetScale(1,5,1) for x = 0, 64 do for y = 64, 128 do height = Math:Random(0,1)+0.5 height = Math:Min(height,1.0) terrain:SetHeight(x,y,height) end end terrain:UpdateNormals() camrot = camera:GetRotation() gx=Math:Round(context:GetWidth()/2) gy=Math:Round(context:GetHeight()/2) move = 0 strafe = 0 while window:KeyDown(Key.Escape)==false do if window:Closed() then break end local mouseposition = window:GetMousePosition() local dx = mouseposition.x - gx local dy = mouseposition.y - gy camrot.x = camrot.x + dy / 10.0 camrot.y = camrot.y + dx / 10.0 camera:SetRotation(camrot) window:SetMousePosition(gx,gy) move = Math:Curve(((window:KeyDown(Key.W)and 1 or 0) - (window:KeyDown(Key.S) and 1 or 0)),move,10) strafe = Math:Curve(((window:KeyDown(Key.D)and 1 or 0) - (window:KeyDown(Key.A) and 1 or 0)),strafe,10) camera:Move(strafe,0,move) Time:Update() world:Update() world:Render() context:Sync() end As for terrain shadows, I haven't seen those since LE2. I suspect it will be re-introduced once LE3 gets vegetation. -
You might want to try restarting your pc because something is definitely not right there, I just downloaded the firepit and it appears to work properly - louder the closer you get / silent when more than 5 meters from it using the fpsplayer. I really miss the LE2 version of entity:EmitSound() as it would inherently take care of the source position and allow you to use source commands on it. The LE3 version of sources seems to have some issues when it comes to ranges, setting the position before playing, and location/creation of listeners seems to have no effect (sometimes).
-
It "sounds" like one of the problems I reported about sources here: http://www.leadwerks.com/werkspace/topic/12542-source-setrange-issue/#entry90449 thats been buried under tutorial reports (Josh really should have made a separate category from engine related bugs for that).
-
Yes based on his other posts, i would assume that is what he is referring to. I believe him and others have reported a skipping effect when moving down a slope.
-
Can't start FPS Advanced Shooter template
macklebee replied to nick.ace's topic in Leadwerks Engine Bug Reports
2) I use the beta and the command 'camera:SetDebugPhysicsMode(true)' works fine for me. As its undocumented, the script editor has never recognized (highlighted) it but it has always worked. -
You will probably have to attach an example script for people to try. I have noticed that this command shouldn't be set each update as it appears to interrupt the particle emissions. Try this example and see if it works for you: function App:Start() self.window = Window:Create() self.context = Context:Create(self.window) self.world = World:Create() self.camera = Camera:Create() self.camera:Move(0,0,-3) self.emitter = Emitter:Create(10) self.emitter:SetParticleColor(1,0,0,1,0) self.emitter:SetParticleColor(0,0,0,1,1) loop = false self.emitter:SetLoopMode(loop) return true end function App:Loop() if self.window:Closed() or self.window:KeyHit(Key.Escape) then return false end if self.window:KeyHit(Key.Space) then if loop==false then loop = true else loop = false end self.emitter:SetLoopMode(loop) end Time:Update() self.world:Update() self.world:Render() self.context:SetBlendMode(Blend.Alpha) self.context:DrawText("Press SPACE to change loop mode",2,2) if(self.emitter:GetLoopMode())then self.context:DrawText("Particles will loop.",2,22); else self.context:DrawText("Particles will not loop.",2,22); end self.context:Sync() return true end
-
Agree with this along with adding a some possible tag information that allows us to see the format (mono, stereo). Ideally, an inherent command (like sound:GetFormat() ) that would return these members as shown here: http://www.leadwerks.com/werkspace/page/api-reference/_/sound/
-
That thickness value as far as I can see is in meters... so I suspect that your box was not large enough to accomplish a hollow operation with a thickness of 16. Edit - If anything i would want the thickness to allow for values lower than 1.
-
--edit josh posted the link
-
http://www.leadwerks.com/werkspace/topic/11925-performance-testing/#entry90738
-
Exactly the problem I stated above - the variable 'self.camRotation' is not defined in that script. Edit- Also i see you are using the inherent fpsplayer and I assume its script. If that is the case, then there is no need for 'Camera 2' as the fpsplayer script creates a camera via code.
- 5 replies
-
- Math:self.camRotation.x
- Programming
-
(and 2 more)
Tagged with:
-
Well you also haven't defined 'self.camRotation' in the above script with what I assume would be a Vec3. So currently the variable is nil and you cannot determine the ".x" until it is defined.
- 5 replies
-
- Math:self.camRotation.x
- Programming
-
(and 2 more)
Tagged with:
-
What is 'Math:self.camRotation.x'? I suspect you just meant to use 'self.camRotation.x'.
- 5 replies
-
- Math:self.camRotation.x
- Programming
-
(and 2 more)
Tagged with:
-
If you set the world gravity after you load the map, it will work. A map will set a gravity value from Scene's Root property panel and effectively over-write your setting. Keep in mind a positive value for the Y-component will cause objects with mass to move up. The Y-value shown in the editor for gravity is actually a negative value.
-
you can try installing it yourself - the installer is located here (assuming youre using windows): C:\Program Files (x86)\Steam\steamapps\common\Leadwerks Game Engine\_CommonRedist\OpenAL\2.0.7.0\oalinst.exe
-
error in function 'SetProjectionMode'.; argument #2 is 'nil'
macklebee replied to Lunarovich's topic in Programming
http://www.leadwerks.com/werkspace/topic/12548-get-set-projectionmode-example-error/ -
Agree that it should definitely be in the official documentation and especially posted in the documentation for Source. Josk though was nice enough to post it here though: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/source/sourcesetrange-r321
-
To keep the documentation and LE syntax theme aligned, the light quality functions should have constants assigned to represent the integer values as returned/used in the World:GetLightQuality() and World:SetLightQuality() commands. Something like: World.LowLightQuality = 0 World.MedLightQuality = 1 World.HighLightQuality = 2
-
The sound you use has to be in mono format to get the 3d spatialization, but it could be related to the problems that I just reported 5 days ago here: http://www.leadwerks.com/werkspace/topic/12542-source-setrange-issue/
-
Ma-Shell points out the syntax is listing the position and normal parameters as floats instead of Vec3's. So does the function actually have 9 parameters or is the syntax correctly listing position and normal as floats.
-
Stop drawing it when you no longer want to show it. As for the quality, I suspect the image originally is not a power of 2 but you have the image saved as a DXT# format which will stretch the image to a power of 2. If that is the case, use the texture editor to set the compression format to 'Uncompressed'. Also make sure you draw the image on the screen at the same ratio of the image's width/height.
-
The lua example script used for Camera:GetProjectionMode() and Camera:SetProjectionMode() will cause an error since the variables 'Camera.Perspective' and 'Camera.Orthographic' are nil.
- 1 reply
-
- documentation
- lua
-
(and 1 more)
Tagged with:
-
huh? you dont see how we would we need to know the name of the constants you are using? Without that, it makes using some of the Get/Set commands kind of difficult to use. The second post here shows exactly why we would need that information. thehankinator figured it out by trial and error but why should everyone have to guess what the constants would be named?
-
And thats fine but like what everyone is pointing out, we don't know the name of the constants. And the one's that are mentioned, there might be confusion on what the lua declared constant is or in some cases the declared constants do not work as advertised. The lua code example for Camera Get/Set ProjectionMode is one such example. I have to use the values 1 or 2 because the supposed declared constants 'Camera.Perspective' and 'Camera.Orthographic' will cause an error because they are nil.