-
Posts
3,946 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by macklebee
-
The GetAngle() returns the rotation of the 2D plane set from SetAngle() apparently. If you rotate your sprite with SetAngle(), it doesn't change the angle of a sprite in billboard mode in reference to the camera - it changes the rotation of the 2D plane around its center. And it appears that the sprites' rotation in relation to the camera does not have anything to do with the sprite's 3D rotation - I assume since its probably a shader controlling the rotation?
-
Not sure if i follow exactly what you are asking for, but here is a simple example of a listbox and a button. When the button is pressed, it will delete the selected item from the table used to create the items in the listbox. local window = Window:Create("example",0,0,400,300,Window.Titlebar+Window.Center) local context = Context:Create(window) local gui = GUI:Create(context) local base = gui:GetBase() base:SetScript("Scripts/GUI/Panel.lua") mitem ={} table.insert(mitem,"Wood") table.insert(mitem,"Steel") table.insert(mitem,"Concrete") table.insert(mitem,"Rubber") table.sort(mitem) button1 = Widget:Button("Delete",240,20,100,40,base) listbox1 = Widget:ListBox(20,20,200,100,base) function AddStuffToList(mytable,widget) widget:ClearItems() System:Print(#mytable) if #mytable > 0 then for n = 1, #mytable do widget:AddItem(mitem[n], n==1) end end widget:Redraw() end AddStuffToList(mitem,listbox1) while not window:KeyHit(Key.Escape) do if window:Closed() then return false end while EventQueue:Peek() do local event = EventQueue:Wait() if event.source == button1 then if listbox1:GetSelectedItem()~=-1 then table.remove(mitem,listbox1:GetSelectedItem()+1) AddStuffToList(mitem,listbox1) end end end context:Sync() end
-
Strange problem after upgraded RX 560 driver
macklebee replied to guido892's topic in General Discussion
Perhaps this is related to this problem posted here: But also there were some possible problems with the material files being used. Can you post the bullethole decal's material file and screenshot of the texture's settings? -
The default I believe in the editor is in centimeter as far as creating CSG objects, but all LE entity commands that use any positions/distances as a parameter/setting is using meters.
-
I do not see any vegetation shaders being used in these material files - does that mean you are hand placing these tree models into your scene and not using the vegetation tool? If you are using the vegetation tool available in the Terrain tool options, then I would recommend using vegetation shaders as well or you will get weird artifacts/shadows. Also, zsort on the leaves' material is enabled - that will affects the shadows that occur on the leaves and maybe related to what you are seeing here? Also you are not using a shadow shader for the leaves' material. Typical pine leaf material for a model that will be used with the vegetation tool: //Leadwerks Material File blendmode=0 castshadows=1 zsort=0 cullbackfaces=0 depthtest=1 pickmode=0 depthmask=1 diffuse=0.501960814,0.501960814,0.501960814,1.00000000 specular=0.000000000,0.000000000,0.000000000,0.000000000 alwaysuseshader=0 roughness=0.50000000000000000 mappingscale=1.00000000,1.00000000,1.00000000 drawmode=-1 shader="Shaders/Model/leaves.shader" shader1="Shaders/Model/Shadow/shadow+alphamask.shader" shader3="Shaders/Vegetation/leaves.shader" shader4="Shaders/Vegetation/Shadow/leaves.shader" texture0="./pine-leaf-fresh-diff.tex" texture1="./pine-leaf-fresh-norm.tex"
-
yep - sorry i forgot to mention that above but I was getting ready to leave for work when i posted
-
table.sort() will sort the table alphabetically. mitem ={} mitem[1] = "Wood" mitem[2] = "Steel" mitem[3] = "Concrete" mitem[4] = "Rubber" System:Print("Unsorted Table******") for k,v in ipairs(mitem) do System:Print(v) end table.sort(mitem) System:Print("Sorted Table********") for k,v in ipairs(mitem) do System:Print(v) end will result in the following output:
-
FPS drop at a rate of time
macklebee replied to tipforeveryone's topic in Leadwerks Engine Bug Reports
Sunspots? Deep-state machinations? Chem-trails? hard to say what would cause that... mostly because you don't give any information at all or an example that could be tried. Maybe you need to reboot you computer? Is this a video of the game being ran from the editor? Is this a release version that you are running independent from the editor but you still have alot of other programs running in the background? Is this a debug version? what is the viewrange on your camera? on the vegetation? Asking because it appears the drops occur when the camera is able to view large sections of the vegetation/terrain. But again, just complete guesses... -
I can't say based on the information why your text is not clearing out properly. Maybe you need to redraw the panel or the label? - not enough info to try to recreate but this simple example seems to work: window = Window:Create("Label Example",0,0,400,300,Window.Titlebar + Window.Center) context = Context:Create(window) gui = GUI:Create(context) base = gui:GetBase() base:SetScript("Scripts/GUI/panel.lua") text1 = "Center with border and vertical align" text2 = "" widget = Widget:Label(text1,20,20,300,80,base) widget:SetString("align","Center") widget:SetString("valign","Center") widget:SetBool("border",true) toggle = 0 while not window:KeyHit(Key.Escape) do if window:Closed() then return false end if window:KeyHit(Key.Space) then toggle = 1 - toggle if toggle == 1 then widget:SetText(text2) else widget:SetText(text1) end widget:Redraw() end context:Sync() end As for color - this seems like its a huge class member missing from the Widget class? Not sure why there isn't a way to set the colors of your widgets or text. The label.lua script has no mention of color. The panel.lua script has color being set but its all hardcoded and I haven't been able to change the colors by accessing the apparent color related members. So unless you decide to start rewriting a lot of the scripts, I am not sure you can change the Widget colors inherently - which just seems to be a fairly large omission? Maybe I am missing something.
-
Clustered Forward Rendering - Multiple Light Types
macklebee commented on Josh's blog entry in Development Blog
Aren't boxlights like area lights? Would you be able to use it for representing light coming from florescent tube lighting? Colored shadows will be nice to have again if the color can be controlled by what is casting the shadow or at least user defined per entity. This would definitely help when you have translucent objects in a scene. It just looks weird to have a completely black shadow cast by something like a glass object like we have now in LE4. If you get this working cheaply that would be pretty amazing. -
Rotating Image around center with Context:SetRotation
macklebee replied to GorzenDev's topic in Programming
Try using this shader to rotate your images: drawimage_rotating.shader Example script that shows usage: window = Window:Create("draw rotating image",0,0,600,400,Window.Titlebar+Window.Center) context = Context:Create(window) imageshader = Shader:Load("Shaders/Drawing/drawimage_rotating.shader") imageshader:SetVec2("pivotposition", Vec2(150.0, 37.5)) --center of image angle = 0 image = Texture:Load("Materials/Developer/leadwerks.tex") while window:KeyDown(Key.Escape)==false do if window:Closed() then break end context:SetColor(1,.3,0) context:Clear() angle = angle +1 defaultshader = context:GetShader() context:SetBlendMode(Blend.Alpha) --Draw Image context:SetColor(1, 1, 1) context:SetShader(imageshader) imageshader:SetFloat("angle", angle) context:DrawImage(image, 150, 150, 300, 75) context:SetShader(defaultshader) context:DrawText(string.format("FPS: %.2f",Time:UPS()), 0 ,10) context:SetBlendMode(Blend.Solid) context:Sync(true) end Video of this and other similar shaders: -
Is the weapon a prefab or a model? Asking because sometimes this doesn't work for prefab parent meshes - only the child mesh. On models, it appears to work all the time. Anyways, this is how you get the name like as shown in the editor when placed in a scene: entity:GetKeyValue("Name")
-
So in your code, you are just constantly creating a shape every cycle of the loop? Seems like that would be something you would want to do in the start code not the loop? thats a lot of shapes being created every second... not to mention the number of surfaces you were making in the first example... Is this your actual code that you are having problems with or just something you are doing to show your problem?
-
Material:SetPickMode broken
macklebee replied to thehankinator's topic in Leadwerks Engine Bug Reports
Can confirm - same happens if you try to use GetPickMode(). But interestingly enough it appears that if you set the pick mode via the Material Editor it will work as expected. But just from my small test it appears to be a slow process for it to ignore the object based on the material's pick mode setting - seemed to make the program stutter a bit. -
Maybe try updating the surface after adding all the vertices/triangles and prior to using it in the PolyMesh()? Surface:Update()
-
Not a bother - but some of the questions you post could be answered easily by yourself if you learn how to do simple troubleshooting. Think how much farther along you could get in your project if you didn't have to post constantly and wait for someone to tell you the answer, if only you could learn how to start troubleshooting your own code. The link to System:Print() was meant to help you as it appears you are new to programming in general.
-
If you notice those commands are not in the official documentation - ergo, not officially supported which means they can change at any time or be removed. But in any case, you should be able to find button hover appearance changes from various examples over the years here. Basically you could just load other brighter button images to be used when the mouse is hovering or maybe you could try changing the SetColor() value when hovering? But in any case, I suspect you will have to rewrite several parts of the inherent GUI code to take in account your images now. If this is something you want to learn how to do on your own or you just want something that does it for you, you could try Aggror's free gui .
-
I would assume its due to trying to hide an entity that doesn't exist. Start your indice at 0 and decrement the loop's end value by 1. for indice = 0, self.Vehiculo:CountChildren() - 1 do llantas[ indice ] = self.Vehiculo:GetChild( indice ) llantas[ indice ]:Hide() end Also - you should learn to use System:Print() as its a very useful troubleshooting command. Use it to see where your code is failing and what the status of a variable is when the code stops working. It will save yourself some time instead of having to post asking questions on how to troubleshoot your own code.
-
Any examples of a car physics system for joints on Lua?
macklebee replied to Yue's topic in General Discussion
Why don't you try it yourself and then post your example if you get stuck on something? People are more willing to help if you show that you have put in a little effort on your own. Start with the example here: https://www.leadwerks.com/learn?page=API-Reference_Object_Vehicle_Build and work from there. Go through the different vehicle commands and try to understand them. Also keep in mind that you KNOW that vehicles are not exactly in great working condition right with the latest version. -
Terrain and world:pick problem
macklebee replied to tipforeveryone's topic in Leadwerks Engine Bug Reports
Not enough info to tell but I suspect this is not a bug. More than likely its an issue with mixing local, global, and/or screenspace positions. -
Zoom when wanting to zoom in on things far away like with binoculars and fov when wanting to increase/decrease the horizontal field of view like peripheral vision..
-
I can't tell from your post if you have a horizontal compass working or not, which is somewhat independent from finding the angle between a player and a target in relation to the player's direction. If you are asking to get the horizontal compass working, calculate the relative angle, and also make the target show up on the compass as well, then this will be a fairly large discussion. And it's another reason why the techass forum is garbage, if this will be a lengthy discussion about multiple things regarding drawing a hud, calculating the relative angle, etc instead of one just concise question about one facet. In any case, if you are just wanting to calculate the relative angle, then you have to calculate the angle between the player and the target based on their global positions, determine the Y-rotation of the player, and then subtract the two. Example script: Script.player = "" --entity "Player Entity" Script.target = "" --entity "Target Entity" Script.angle = 0 function PerfectAngle(pos1,pos2) local dx, dz dx = pos2.x - pos1.x dz = pos2.z - pos1.z return Math:ATan2(dx,dz) end function NormalizeAngle(angle) if angle <= 0 then return angle + 360 else return angle end end function Script:UpdateWorld() self.perfectangle = PerfectAngle(self.player:GetPosition(true),self.target:GetPosition(true)) self.angle = self.player:GetRotation(true).y - self.perfectangle end function Script:PostRender(context) context:SetBlendMode(Blend.Alpha) context:DrawText(string.format("Angle between Player to Target: %.0f",NormalizeAngle(self.angle)),2,22) context:SetBlendMode(Blend.Solid) end Place a pivot into a scene and attach this script. Drag the Player and Target entities into the Script's Property dialog and run the game.
-
Voxel Cone Tracing Part 4 - Direct Lighting
macklebee commented on Josh's blog entry in Development Blog
You need to tighten up the graphics - that stuff looks pixelated.