-
Posts
3,946 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by macklebee
-
You have to turn off the sandbox lua option to be able to write to/delete a file or directory. Go to Tools-->Options... and uncheck the 'Sandbox Lua' option. Also the first picture you posted shows you trying to write to a file in the 'Config' directory. If that directory does not already exist, it will fail to write to the file. Look at the FileSystem:CreateDir() to create a directory - again this requires that the sandbox lua option be unchecked. Keep in mind that Leadwerks Game Launcher will not allow un-sandboxed commands like writing to or deleting a file. Edit-- a way to get around the sandbox issue is to write to your game's config file (typically located at 'C:\Users\~ComputerName~\AppData\Local\~GameName~\GameName.cfg') using System:SetProperty(key, value) then reading the key using System:GetProperty(key).
-
The engine commands are the same between lua and C++. If you are using C++, then you should be able to decipher lua.
-
Look at the FPSGun.lua script located in the 'Scripts/Objects/Weapons' folder. It shows exactly what you are asking for - applying the muzzleflash material to a sprite.
-
Sure, just make a box primitive and apply the blueprint as the texture for its material. Then click on View-->Render Mode-->Textured. If you need the blueprint box to be slightly transparent in the view, just set its material to the Light blend mode.
-
Calculation of text scaled down to fit inside a rectangle (postrender)
macklebee replied to Slastraf's topic in Programming
This post gives an example way to do it: http://www.leadwerks.com/werkspace/topic/13485-font-sizes/#entry94658 Another way would be to draw the text to the display's surface/face: http://www.leadwerks.com/werkspace/topic/10311-drawing-dynamic-material-on-models-and-similar/#entry76089 -
A quick and dirty method is to place the objects as a child underneath a parent object in the Scene filters panel and then set the Hide option in the parent's Appearance tab.
-
I would suggest looking over the inherent scripts as they are already created to show how to perform one shots, looping, blending animations between each other, etc... The FPSGun.lua script (along with the AnimationManager script) performs everything you are asking. But a simple example of a one-shot animation not taking into account blending: window = Window:Create("Example", 0, 0, 800, 600, 17) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:SetPosition(0,.8,-1.2) light = DirectionalLight:Create() light:SetRotation(35,35,0) player = Model:Load("Models/characters/crawler/crawler.mdl") frame = 0 blend = 1.0 sequence = "Idle" recursive = true oneshotdone = true while not window:KeyHit(Key.Escape) do if window:Closed() then return false end if window:KeyHit(Key.Left) and oneshotdone==true then sequence = "Attack1" frame = 0 oneshotdone = false end if window:KeyHit(Key.Right) and oneshotdone==true then sequence = "Attack2" frame = 0 oneshotdone = false end player:SetAnimationFrame(frame,blend,sequence,recursive) frame = frame + Time:GetSpeed() if frame>=player:GetAnimationLength(sequence) then sequence = "Idle" frame = 0 oneshotdone = true end Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:DrawText("Press Left/Right Arrow Keys",2,2) context:SetBlendMode(Blend.Solid) context:Sync(true) end
-
Why are you building your own skybox? Why not just use the inherent command camera:SetSkybox() that will create, position, and render properly everything you need?
-
3ds Max - Multiple Materials on an animated model.
macklebee replied to martyj's topic in Game Artwork
This has come up just recently. Collision hulls/meshes will not work with animated models. See here: http://www.leadwerks.com/werkspace/topic/14482-no-collision/#entry99088 -
example code showing copied models with different materials: http://www.leadwerks.com/werkspace/topic/12249-model-copy/#entry88822
-
No, I am referring to the Map:Load() before the main loop: --Load a map local mapfile = System:GetProperty("map","Maps/start.map") if Map:Load(mapfile)==false then return end Just load the name of your map instead of the default start.map
-
Look at the 'Main.lua' script. Load the map you want to load.
-
Well, no I don't have to render the lights twice for the look I was going for... essentially I was just writing the character's normal map texture to fragData0. For that effect, I don't see how you could get away without using two buffers? It needs a comparison of depths to determine if an object is behind something. And for heathaze, LE2 just used a modified particle effect shader with a normal texture that had access to LE2's light buffer, which I do not think we have access to in LE4 since the rendering lights stage is done behind the scenes in World:Render(). But anywho - so your request is that you want the ability to write to custom buffers/channels specified in a model shader?
-
In that effect, I am writing to a custom buffer in another world, comparing its depth buffer to the main world's depth buffer, and based on the differences, determining what to write to fragData0.
-
I'm not sure I understand the suggestion. You can make additional custom buffers now... take a look at the post-process lua scripts available and you will see that they create buffers in some of them. The 'bloom' script is a good example.
-
This should not occur. You should post your code. Or compare my example to what you are doing to see the difference.
-
SetInput doesn't make entity face requested angle
macklebee replied to thehankinator's topic in Programming
this seems to work ok - at least better than what the code above is showing for the player angle which for some reason is never close to the set angle: angle = 0 --defined before main loop ... ... p_rot = player:GetRotation(true) if window:KeyHit(Key.Right) then angle = 270 end if window:KeyHit(Key.Left) then angle = 90 end finalangle = Math:CurveAngle(angle, p_rot.y, 1.05)--setting division parameter to 1 or lower results in weird angles player:SetInput(finalangle, 0, 0, 0, false, 1, 0.5, false, 0.0) Other than that, I could only suggest you stick with a rigid body physics player and move/rotate using SetPosition/SetRotation. -
We will probably need to see all of the code that initializes the array and then accesses it in another function to determine the problem. But if I had to guess is that you are setting the 'fx' & 'fy' variables local to a function other than the function you are accessing the array with so those are not defined in the access function. Again without seeing your full code example, its hard to troubleshoot.
-
good catch - fixed in the code above. I didn't see it since my code is drawing a texture over the entire context, but that's exactly what would happen if I was not doing that.
-
so you are not rendering a world, but just drawing 2D items? If thats the case, then just clear the context prior to drawing any of the 2D items each loop. simple example: window = Window:Create() context = Context:Create(window) background = Texture:Load("Materials/Developer/greengrid.tex") crosshair = Texture:Load("Materials/Hud/crosshair.tex") ch_width = crosshair:GetWidth() ch_height = crosshair:GetHeight() window:HideMouse() while window:KeyDown(Key.Escape)==false do m_pos = window:GetMousePosition() context:SetColor(1,1,1) context:Clear() context:DrawImage(background,0,0,context:GetWidth(),context:GetHeight()) context:SetBlendMode(Blend.Alpha) context:SetColor(0,0,1) context:DrawImage(crosshair, m_pos.x - (ch_width/2), m_pos.y - (ch_height/2)) context:SetColor(1,0,0) context:DrawText("Mouse position: "..m_pos.x..", "..m_pos.y, 2, 2) context:SetBlendMode(Blend.Solid) context:Sync(true) end
-
Good stuff, diedir. Look forward to playing!
-
When you specify a collisiontype in any of the Pick commands, you are setting the collisiontype of the raycast itself and effectively saying to test based on this diagram: http://www.leadwerks.com/werkspace/page/api-reference/_/command-reference/collision-r778 Also, since you have the parameter 'closest' set to true, it will return the first object that satisfies the collisiontype/collision response settings. If you want to be only able to pick the scene/terrain, then based on the diagram you should use Collision.LineOFSight. Edit: But yes, there does seem to be something quirky going on with setting the raycast's collisiontype to Scene. It is returning collisions with Scene and according to that diagram it should not. Its strange because it appears that other collision types/responses work as expected. Out of curiosity, what are you trying to accomplish with the pick? The pick position is essentially just returning the player position...
-
Post your code.
-
I believe this feature was not meant for animated models. If you delete the animations from FBX then convert to MDL, it will show you the collisionhull as a physics shape in the Model Editor.
-
entity:GoToPoint() doesnt work, or what am I doing wrong
macklebee replied to Slastraf's topic in Programming
It's missing the line: App.world:BuildNavMesh() Look at Entity:GoToPoint as a reference: http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitygotopoint-r700 Edit: And interesting enough, the SetNavigationMode example, when fixed, highlights the bug report that shows characters walking through items with mass: http://www.leadwerks.com/werkspace/topic/14323-character-pass-through-objects-with-mass/- 6 replies
-
- GoToPoint()
- entity:GoToPoint()
-
(and 2 more)
Tagged with: