-
Posts
3,946 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by macklebee
-
There is also a way to center text inherent to LE in available parameter settings not in the official documentation, but was posted at one point in the gui development blog, virtual void DrawText(std::string& text, const int x, const int y, const int width, const int height, const int style = 0);//lua So in your example, I would set the x and y positions as the upper left hand corner of the circle's image and the width/height as the width and height of the circle. Example showing drawing text within the center of a rectangle where the text width is changing and the style parameter settings are keeping it centered: window = Window:Create("example",0,0,400,400) context = Context:Create(window) world = World:Create() light = DirectionalLight:Create() light:SetRotation(45,45,0) camera = Camera:Create() camera:SetPosition(0,0,-3) counter = 1400 toggle = 0 myfont = Font:Load("Fonts/arial.ttf", 36) context:SetFont(myfont) while not window:KeyHit(Key.Escape) do if window:Closed() then return false end if toggle==1 then counter = counter + 10 end if toggle==0 then counter = counter - 10 end if counter>=1400 then toggle = 0 end if counter<=10 then toggle = 1 end Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:SetColor(1,0,0,.5) context:DrawRect(38,30,300,300,1,30) context:DrawText(string.format("%.0f",counter),38,30,300,300,Text.VCenter+Text.Center) context:SetColor(1,1,1,1) context:SetBlendMode(Blend.Solid) context:Sync(true) end
-
You are doing a World Pick on the global Y-axis from +10 to -10. The pick is returning that it successfully picked something between these two points. The raycast is not from the cone. The raycast starts at the (0,10.5) point in space. The raycast ends at (0,-10,5), If it hits anything, it will return true. You have the cone sitting right where this raycast is occurring. It is hitting the cone. Try reading the documentation and try out the examples. World:Pick()
-
Have I mentioned how much I dislike the tech *** forum? Fixed the OP's issue, but who knows because if the OP likes the answer, it removes the post from the order of the discussion. ****ing Garbage. Anyways. your choices for SetPickMode() as found in the documentation: 0: pick tests will skip this entity. Entity::SpherePick: a sphere test with the entity pick radius will be used. Entity::PolygonPick: if the entity is a model or a brush, a precise polygonal pick test will be performed. Entity::BoxPick: a box test with the entity pick radius will be used I'd advise you to RTM. <<-- polite version. And no, you can't see the "beam". You can draw the "beam" if you wish using DrawLine or creating/scaling a polygon model from the start and end pick points. There are examples of this if you search the forum for "beam"
-
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'.
-
I did not find entity:SetDamping in documentation
macklebee replied to tipforeveryone's topic in General Discussion
Sets the damping value of a physics body. Damping slows the velocity and omega each frame by a small amount. Example: window = Window:Create("Linear Damping Example",0,0,800,600,Window.Titlebar+Window.Center) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:SetPosition(0,10,-6) camera:SetRotation(45,0,0) light = DirectionalLight:Create() light:SetRotation(35,35,0) ground = Model:Box(50,1,50) ground:SetPosition(0,-0.5,0) ground:SetColor(0,1,0) shape = Shape:Box(0,0,0, 0,0,0, 50,1,50) ground:SetShape(shape) shape:Release() box = {} for i = 1, 3 do box[i] = Model:Box() box[i]:SetColor(1-0.5*(i-1),-0.5*(i-1),.5) shape = Shape:ConvexHull(box[i]:GetSurface(0)) box[i]:SetShape(shape) box[i]:SetPosition(-8+i*4,1,0) box[i]:SetMass(1) box[i]:SetDamping(1-0.5*(i-1),1.0) end while window:KeyHit(Key.Escape)==false do if window:Closed() then break end if window:KeyHit(Key.Space) then for i = 1, 3 do box[i]:AddForce(0,0,1000,true) end end Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:DrawText("Linear Damping (from left to right): 1, 0.5, 0",2,2) context:DrawText("Press SPACE to apply the same force to all boxes!",2,22) context:DrawText("The higher the damping-value, the faster the box stops.",2,42) context:SetBlendMode(Blend.Solid) context:Sync(true) end -
What Makes a Good Brand Name?
macklebee commented on Josh's blog entry in Ultra Software Company Blog
Fair enough - and I hope you are correct. I'm probably in the upper age percentile of your user base, so my perception of the word 'turbo' probably has a different connotation than what maybe the other younger users have with that word. Heh. What's funny about that is you associate it with a 2013 far cry game that is purposely emulating an 80's style whereas I am just associating it with the 80's. Thanks for making me feel old. Then again I am sure half the people that read Josh's response about Karate Kid, first thought of that horrible remake with the Fresh Prince's kid. And I am pretty sure only a handful of people here understood my New Coke™️ reference without googling it... In any case, I do hope Josh is right and I do agree with the decision to stay away from 'Turbo 3D' - it would be too much like a motel today promoting it has color tv's or a 2018 movie boasting to have technicolor. I would vote for Turbo Engine / turbo / TE as the possible ways to reference and stay far away from any TGE usage. -
Need more information. Are you saying that when your character's physics mode is changed to Character and you have the physics debug mode on, your character is halfway into the ground? Where is your player model's origin located? If its at the center instead of its feet, the base of the controller will be at the waist. Or are you saying that the character model is sinking into the ground while the controller stays above ground? Would be useful if you provided enough information to see exactly what you are doing wrong - example map, code, the character's physics property settings, or even the model itself (if its not proprietary)...
-
Exactly. Use triggers to toggle crouch. Could do the same for the player as well so the user doesn't even have to do it.
-
Are you talking about whether or not the navigation system will create a navmesh in an area for crouching? Not inherently due to the restriction built into the navmesh creation. But you can always get around that by being creative on what entities have their navigation mode set to true when you are building your scene. In my example above with the 3 boxes, I would set the ground and the two vertical boxes' navigation mode to true and not the horizontal. This would allow for a navmesh to be built under the box.
-
What Makes a Good Brand Name?
macklebee commented on Josh's blog entry in Ultra Software Company Blog
TGE - not exactly the abbreviation you want your new engine to be associated with, is it? a failed engine that died a bloated mess that became so commercially unattractive they made it open source? and wth is TEG- just stop. Honestly, the more I say it out loud and look at this- I agree with cangojoe initial response. 'Turbo' seems dated and maybe since I'm old I can remember the 80's where everything had turbo as its name or feature to the point that it really meant nothing. It's like the 90's version concerning the usage of the word 'EXTREME'. Or maybe thats your plan. Version1 is turbo, version2 is super turbo, version3 is extreme turbo... ? Dunno. I think its a shame you are abandoning a brandname with recognition and reputation because some person might not be able to pronounce it correctly the first time they come across it in print. I just hope your idea here doesn't turn into New Coke ™️ Edit -- Not trying to be rude here, just upfront and honest with you. You seem to get a lot of fanboyish, yes-men feedback here. But if memory serves, some of the people I see posting here about how much they like this name are some of the same people that encouraged you to make LE3 initially for mobile. -
Defranco is correct and I am not sure why this keeps getting stated that crouching is not available?? For some flarking reason it is not officially supported and you have to take care of the animation, the movement/position of the camera, and understand the crouch height limit (1.2m), but it works. I think people are assuming since the visual representation of the physics body does not change shape when crouched that the actual physics body did not change shape. In LE2 days, the visual also changed when crouched.
-
Three improvements I made to Leadwerks Game Engine 5 today
macklebee commented on Josh's blog entry in Development Blog
ooh! area lights please! -
Is posible to draw background image and the 3d world drawn on top ?
macklebee replied to aiaf's topic in General Discussion
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/ -
Is posible to draw background image and the 3d world drawn on top ?
macklebee replied to aiaf's topic in General Discussion
I would suggest that if you use qbit then your initial picture probably needs to be seamless to begin with or you will end up with the hard transitions that these images show. If the individual images have these hard transition lines then of course the cubemap will have them too. -
Is posible to draw background image and the 3d world drawn on top ?
macklebee replied to aiaf's topic in General Discussion
A skybox is what you want since it inherently works with sprites and emitters because LE is controlling the order these items get rendered. You should post an example picture that you are trying to accomplish as I am sure someone can help convert it properly to something useable. -
Is posible to draw background image and the 3d world drawn on top ?
macklebee replied to aiaf's topic in General Discussion
Try this with the understanding that it doesn't play well with sprites or particles: --insert before main loop mybuffer = Buffer:Create(window:GetWidth(),window:GetHeight(),1,1) --custom buffer image = Texture:Load("Materials/Developer/bluegrid.tex") --load the background image --in the main loop currentbuffer = Buffer:GetCurrent() --add this mybuffer:Enable() --add this --Render the world world:Render() --this should already be there currentbuffer:Enable() --add this context:SetColor(1,1,1,1) --add this if using std fpsplayer cuz Josh doesn't clean up his context SetColors! context:DrawImage(image,0,0,window:GetWidth(),window:GetHeight()) --add this context:DrawImage(mybuffer:GetColorTexture(0),0,0,window:GetWidth(),window:GetHeight()) --add this --draw text and images etc after if required -
Is posible to draw background image and the 3d world drawn on top ?
macklebee replied to aiaf's topic in General Discussion
so basically a skybox. so create a skybox cubemap texture as your background and render the 3d world as normal. -
Dragging Animations Into Animation Window
macklebee replied to gamecreator's topic in Suggestion Box
So what you are asking for is what you can currently do within the Model Editor with the File>Load Animation dialog except you want it to be able to multi-select instead of one at a time. -
SetResponse is not officially documented for some reason but if you search the forum you will find plenty of examples of it. What you are showing should work assuming the endpoints of the World Pick are where you think they are. You may need to place a sphere at the pick position to confirm. Another way to do this would be just pick everything by setting the Pick's collisiontype to '0' then filtering the results by checking the collisiontype/name/etc of the picked entity. Example: window = Window:Create() context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:Move(0,1,-5) light = DirectionalLight:Create() light:SetRotation(35,35,0) enemy = Model:Load("Models/Characters/generic/generic.mdl") enemy:SetPosition(-4,0,0) enemy:SetRotation(0,90,0) enemy:SetColor(1,.5,0,1) enemy:SetCollisionType(Collision.Character) player = Model:Load("Models/Characters/generic/generic.mdl") player:SetPosition(4,0,0) player:SetColor(0,1,0,1) player:SetCollisionType(Collision.Character) player.health = 1000 wall = Model:Box() wall:SetScale(0.2,1,1) wall:SetColor(0,0,1,1) wall:SetCollisionType(Collision.Prop) toggle1 = 1 toggle2 = -1 while window:KeyDown(Key.Escape)==false do if window:Closed() then break end if wall:GetPosition().y > 3 then toggle1 = -1 elseif wall:GetPosition().y < -1 then toggle1 = 1 end wall:Translate(0,0.01*Time:GetSpeed()*toggle1,0) if player:GetPosition().y > 3 then toggle2 = -1 elseif player:GetPosition().y < -1 then toggle2 = 1 end player:Translate(0,0.02*Time:GetSpeed()*toggle2,0) Time:Update() world:Update() world:Render() pickinfo = PickInfo() p0 = enemy:GetPosition() -- enemy position p1 = p0 + Vec3(0,1.7,0) -- adding height so ray comes from enemy eyes p2 = player:GetPosition() p3 = p1 + Vec3(10,0,0) -- 10m ray out from enemy eyes pick = world:Pick(p1,p3,pickinfo,0,true,0) -- pick between two defined points if pick then if pickinfo.entity==player then player.health = player.health - 0.1 end --do damage to player d1 = camera:Project(pickinfo.position) -- just to show raycast hitpoint end d0 = camera:Project(p1) -- just to show raycast startpoint context:SetBlendMode(Blend.Alpha) context:SetColor(1,0,0,1) context:DrawText(string.format("Player Health: %.1f",player.health), 2, 2) context:DrawText("Pick: "..string.format("%s", pick),0,20) n0 = camera:Project(p0) n1 = camera:Project(p2) context:DrawText("ENEMY",n0.x,n0.y) context:DrawText("PLAYER",n1.x,n1.y) if pick then context:DrawLine(d0.x,d0.y,d1.x,d1.y) end context:SetColor(1,1,1,1) context:SetBlendMode(Blend.Solid) context:Sync(true) end
-
Here is the table that for some reason has been removed from the documentation: If you are trying to only have a collision with the character then you will need to make a new collision type that only interacts with a character using SetResponse(). Then use that new collsiontype with your Pick. See this post for more info:
-
It would be a lot easier if we had code to review and try for ourselves. The video is nice as it shows what the effects of the issue but doesn't help us see what you are doing wrong. Show us your pick code. Or better yet, make a small example map and available code that we can easily try.
-
lua dofile prevents exported game from starting
macklebee replied to Phodex Games's topic in General Discussion
Nothing special required for sandbox mode being turned off - just know that it has loaded lua modules or LE sandbox-disabled specific commands that someone could attempt to do nefarious things with.., which is why lua sandbox enabled was the only option for games uploaded to the game launcher. In any case, don't use dofile due to the path issue with an exported game- use Interpreter:Executefile() or import depending on how you are using the loaded file. Both will work with sandbox mode enabled or disabled and will work with data.zip. EDIT - updated to point out that dofile works with sandbox enabled. The problem is due to the file path changing once everything is exported to a data.zip folder. -
lua dofile prevents exported game from starting
macklebee replied to Phodex Games's topic in General Discussion
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 -
os.time works but it requires that lua sandbox be disabled. If you are trying to get a number to use with randomseed() and random(), try using Time:Millisecs() as it doesn't require lua sandbox to be disabled. On a side note: os.date seems to be more user friendly if anyone is trying to obtain time in hours/minutes/seconds... https://www.lua.org/pil/22.1.html window = Window:Create("CLOCK",0,0,500,500,Window.Titlebar+Window.Center) context = Context:Create(window) world = World:Create() camera = Camera:Create() light = DirectionalLight:Create() light:SetRotation(30,35,0) box1 = Model:Box() box1:SetPosition(0,0,1.5) box1:SetColor(1,0.5,0,1) while not window:KeyHit(Key.Escape) do if window:Closed() then return false end box1:Turn(0,Time:GetSpeed()*0.5,0) Time:Update() world:Update() world:Render() local temp = os.time() context:SetBlendMode(Blend.Alpha) context:DrawText(os.date("%I:%M:%S"),2,2) context:DrawText(temp,2,22) context:DrawText(os.date("%X", temp),2,42) context:SetBlendMode(Blend.Solid) context:Sync(true) end
- 1 reply
-
- 2
-
You need to post an example of your problem because what you are describing is exactly what my code does. If you notice from the post pic the text is being drawn onto the buffer and then the color texture is being set to the material. If there was no transparency on that "text buffer" then you would not see the concrete texture on the box.