thehankinator
-
Posts
436 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by thehankinator
-
-
Have you tried SetIntensity()? That's what the flicker script uses, worked for me.
http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitysetintensity-r163
-
Sorry, posted the backup script by accident.This is the real one that I have been using (The Example one).
Is that whole thing in your Main.lua? If so, you've got the pause screen script combined with the Main.lua script. The second portion (starting with the second "import" line to the end) should go in it's own script and be assigned to a pivot in your level.
-
Here it is
This Main.lua does not have the changes required for the UI system to work. The Main.lua in Addons/THUI/Examples should have all the changes you need, Copy it your Scripts directory.
-
I've been thinking about this for my UI library. It's an awkward problem that I've not found a perfect solution for but this might work for your use case.The following function will determine a font height so that it will fit in a box defined by w and h. It will start with the font at max size, if the text goes beyond the defined width, it will reduce the font size to fit.
It loads a font every time you call it so I would call it only when text changes.
function FontFit(fontpath, text, w, h) local font = Font:Load(fontpath, h) textwidth = font:GetTextWidth(text) font:Release() if textwidth > w then return h * (w / textwidth) else return h end end
An example of loading a font that will fit some_text that will fit in an area of 100x30
local FontHeight = FontFit("Fonts/arial.ttf", some_text, 100, 30) local font = Font:Load("Fonts/arial.ttf", FontHeight)
- 1
-
The below code:
assert(false, "Why:Does this happen?")
Gives the following result:
"C:/Users/User/Documents/Leadwerks/Projects/MyGame/Addons/THUI/Core.lua" : 80 : Why
If I simply don't use a colon it prints the whole string. What's the deal with the colon character? I don't see anything in PIL for this behavior https://www.lua.org/pil/8.3.html
-
I'm just not sure where I am going wrong, I have tried to replace the normal main.lua with the example one. I also have tried following the instructions on this page in an attempt to try and make a simple GUI Menu. When I press the esc key, nothing happens. Any help?
Would you post the code for your menu? I'll take a look.
-
self is nil? Is it possible that the code calling this function uses a a dot instead of a colon?
Blah.GetPosPiv() vs Blah:GetPosPiv()
-
Your textures have details that clash with your geometry. You should use either neutral textures on those beams or have some interplay between your level geometry and textures. See Dexsoft's texture packs for examples of this:
Or my own design, using a combination of CSG and some detail props. Notice that my design still flows from the textures:
This might be a dumb question but how do you determine if a texture clashes with the geometry?
-
Can anyone who experienced this bug previously please download the latest Win10 driver and tell me if this demo still displays an error:
http://community.amd.com/amd.zip
If so, please tell me your exact graphics card.
Link to amd.zip is dead, I still have it from before, got it from http://leadwerks.com/amd.zip. Anyway, still broken. Details below:
-
Tried to push an update to my UI library tonight, editor crashes every time. I'm on beta.
-
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.
I noticed my example used -90 and yours used 270 so I tried mine with 90/270 but still no luck.
If I understand the update to SetInput correctly, I shouldn't need to play games with interpolating the angle to get the rotation to work. According to the updated reference for SetInput, setting maxrotationspeed to 0 should result in an instantaneous change to the requested angle. I might be misunderstanding the documentation but I think that my script should work.
I'd love to use rigid body physics with SetRotation but then I'd have to implement my own pathing algorithm which seems like a lot of added work and complication when all that functionality already exists in LE it's just this one part that doesn't work and I think should.
-
Any ideas?
-
I probably should make the documentation more clear. The example Main should not be on a pivot, it would replace Main.lua in your scripts directory.
-
@hank that would be for Lua not C++ like he's using.
That's what I get for not reading the post, my mistake.
-
I think it is the name of the function as a string.
-
Have you verified that the animated shaders are being used on the materials?
-
A little way down here I talked about field of view: http://www.leadwerks.com/werkspace/topic/12805-basic-sneaking-tutorial/
-
I am having trouble getting the instantaneous change working. I've updated my original script (below) to set the new flags. Unfortunately I am not getting the instantaneous change I was expecting. I used default for everything except maxrotationspeed, I set it to 0. I also tried setting maxrotationspeed to 360 as well as detailed to true but that didn't help either. Did I misunderstand how to use this change? I am opt into beta.
--Create a window window = Window:Create() context = Context:Create(window) world = World:Create() local camera = Camera:Create() camera:SetRotation(35,0,0) camera:Move(0,0,-8) local light = DirectionalLight:Create() light:SetRotation(35,35,0) --Enable navmesh debugging camera:SetDebugNavigationMode(true) --Create the ground local ground = Model:Box(10,1,10) ground:SetPosition(0,-0.5,0) ground:SetColor(0.0,0.25,0.0) --Create a shape local shape = Shape:Box(0,0,0, 0,0,0, 10,1,10) ground:SetShape(shape) shape:Release() --Enable navigation obstacles ground:SetNavigationMode(true) --Create a character player = Pivot:Create() local visiblecapsule = Model:Cone(16, player) visiblecapsule:SetScale(1,2,1) visiblecapsule:SetPosition(0,1,0) visiblecapsule:SetRotation(90, 0 ,0) player:SetPosition(0,0,0) player:SetMass(1) player:SetPhysicsMode(Entity.CharacterPhysics) while not window:KeyHit(Key.Escape) do if window:Closed() then return false end Time:Update() if window:KeyHit(Key.Right) then player:SetInput(-90, 0, 0, 0, false, 1, 0.5, false, 0) end if window:KeyHit(Key.Left) then player:SetInput(90, 0, 0, 0, false, 1, 0.5, false, 0) end if window:KeyHit(Key.P) then System:Print(player:GetRotation(true).y) end world:Update() world:Render() context:Sync() end
-
Also there is the same thing in Lua itself:
math.cos(angle)
Be careful, the LE function takes degrees where as the built in lua function takes radians(since 4.0).
- 1
-
See docs update. Engine update will come tomorrow:
http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitysetinput-r706
Looks awesome, I think the other options you added will also be useful also. Thanks!
-
Okay, I am adding an extra parameter so you can specify the max rotation speed.
Josh for president!
-
Only reason I downloaded it was to see what the big deal was lol
-
Why would you want to? Presently, it is hard-coded into the engine so that it will move at most 5 degrees per update.
I'm working on an action RPG something similar to Diablo style. When I click on the screen I want my character to immediately turn to the direction of the click and fire.
-
You know it's going to gradually turn in the right direction, right? It won't instantly face that direction.
How could I make a character controller instantly face a direction?
Resolution Question
in Programming
Posted
If you are using Autoscale, the THUI will scale whatever resolution you are set to. Anchor and Absolute will not (at this time anyway).