-
Posts
3,946 -
Joined
-
Last visited
Community Answers
-
macklebee's post in Number Random Script Lua? was marked as the answer
with inherent lua:
http://www.lua.org/manual/5.1/manual.html#5.6
math.randomseed(Time:Millisecs()) myvariable = math.random(min,max) with LE functions:
https://www.leadwerks.com/learn?page=API-Reference_Object_Math_Random
Math:SeedRandom(Time:Millisecs()) myvariable = Math:Random(min,max) In both cases, you need to set the minimum and maximum values (min & max) that the random number should be equal to or fall between.
Just FYI - there is a search available in the upper right-hand corner of the forum that can allow you to search for stuff like this :
-
macklebee's post in Alpha Image? was marked as the answer
DXT1 compression does not store alpha. DXT3 will show alpha - but its all or nothing. DXT5 will show alpha in a full gradient from 0 to 1. Uncompressed texture will also show the alpha and is best for a GUI image.
Read the documentation on compression as this information is available:
https://www.leadwerks.com/learn?page=Tutorials_Editor_Textures
-
macklebee's post in Character Controller Physics was marked as the answer
The problem with using a CSG cylinder instead of a model is that its origin is at the center and not at the base (or the feet like with a character model). If you look at the SetInput() example, notice that the 'visiblecapsule' cylinder is set as a child to the pivot (which is the actual player) and the cylinder's center is positioned up 1 meter from the ground.
-
macklebee's post in Importer of FBX models broken into 4.6 Leadwerks was marked as the answer
The model is extremely small. Open the model in the Model Editor and click Tools-->Resize. Scale the model up by 1,000% and then save. Do this twice as the Model Editor will only allow you to scale at the maximum of 1,000%. Drag the newly scaled model into the scene.
-
macklebee's post in Background Seeps Around Edges was marked as the answer
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"
-
macklebee's post in GUI Loading Image to Button? was marked as the answer
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 .
-
macklebee's post in Close Leadwerks script Lua?? was marked as the answer
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.
-
macklebee's post in Pick?? was marked as the answer
The pick is working - you just are not confirming if the pick is occurring correctly.
if mundo:Pick(0, 10, 5,0, -10, 5, pis,1.0, true ) then ventana:Closed() end ventana:Closed() does not close the window, it only checks if the window has been closed. Refer to the documentation: Window:Closed()
I would suggest doing a 'System:Print()' as a way to confirm if the pick was successful. But if you really want to exit the program after the first loop when the pick is successful then change the code to this:
if mundo:Pick(0, 10, 5,0, -10, 5, pis,1.0, true ) then System:Print("Pick Successful") return false end Edit -- also, unless the user knows exactly what they are doing and what to expect, I would advise you to stay away from giving your pick a radius as its slower and may give unwanted results. I'd advise you to use the precise raycast by using a radius of '0'.
-
macklebee's post in Is posible to draw background image and the 3d world drawn on top ? was marked as the answer
Have you tried other skybox generators out there? Or ChrisV has put out skybox packs in the workshop: https://steamcommunity.com/workshop/browse/?appid=251810&searchtext=&childpublishedfileid=0&browsesort=trend§ion=readytouseitems&requiredtags[]=Texture
http://wwwtyro.github.io/space-3d/#animationSpeed=0&fov=143.1660557755857&nebulae=true&pointStars=true&resolution=1024&seed=3unwfq950v60&stars=true&sun=false
https://www.nutty.ca/webgl/skygen/
-
macklebee's post in lua dofile prevents exported game from starting was marked as the answer
The lua function dofile is exposed in LE4. It works in editing mode with lua sandbox turned ON or OFF. The reason dofile is failing is due to how the file path is changed when everything is placed inside data.zip within the game directory. For example, prior to publishing myscript.lua is in the "MyGame/Scripts" folder, and after exporting myscript.lua is now in the "Scripts" folder inside the data.zip file located in the "MyGame" folder. Dofile will work if the path from the executable's root folder to the file in question has not changed. So this means you can create a folder called "Scripts" within the root folder and put myscript.lua in there. But this means your files are exposed....
While import does work - it will only load the file once. So if you are using import to set variables by loading multiple scripts, it will only let you set it once with that file. So the LE sandbox version of dofile is 'Interpreter:Executefile("luascript.lua")'. Also, since it is an inherent command in LE, it works when published from the data.zip without having to worry about paths being changed.
Example: Files, myfile1 & myfile2, contain the variables A, B, & C set to various values.
window = Window:Create("example",0,0,400,300,Window.Titlebar+Window.Center) context = Context:Create(window) world = World:Create() camera = Camera:Create() gui = GUI:Create(context) base = gui:GetBase() x=140 y=110 local sep=30 button1 = Widget:Button("Dofile 1",x,y,100,25,base) y=y+sep button2 = Widget:Button("Dofile 2",x,y,100,25,base) A = 0 B = 0 C = 0 D = 0 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 filetodo = "Scripts/myfile1.lua" elseif event.source == button2 then filetodo = "Scripts/myfile2.lua" end Interpreter:ExecuteFile(filetodo) end D = A + B - C Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:DrawText("D = "..D,2,2) context:SetBlendMode(Blend.Solid) context:Sync() end
-
macklebee's post in Missing vertex group was marked as the answer
First thing I see is that the parts that are not visible in LE are not part of the animated hands. You do not appear to have weighted their vertices to the hand movement. Also, the parts not seen have their faces inverted. You can see this in the mdl version I created where I had fixed the gun model not being weighted completely to the hand model animation. Open up in the model editor, click Tools>Flip Faces and you will see your missing faces.
If you fix the weighted vertices issue and flip the faces on those parts in your modeling program, it should look correct.
m9_hands_modified.mdl
-
macklebee's post in Disappearing World was marked as the answer
or if not vegetation but just a model, then look at the View Range setting in the editor under the Appearance tab in the Scene panel. https://www.leadwerks.com/learn?page=Tutorials_Editor_Scene-Panel
or if you are creating these models dynamically through code, then set the view range by SetViewRange().
-
macklebee's post in Raycasts in Leadwerks was marked as the answer
See this monthly script challenge for an example of what you are attempting:
-
macklebee's post in .fbx animations not showing up was marked as the answer
are the trigger and magazine bones or just other sub meshes in the model?
hmmm - if you post the model, i think uu3d can convert it properly to something LE can use. But other than that you would need to place bones in the model and set the keyframes based on their PRS.