Jump to content

macklebee

Members
  • Posts

    3,946
  • Joined

  • Last visited

Everything posted by macklebee

  1. Camera Pick: http://www.leadwerks.com/werkspace/page/api-reference/_/camera/camerapick-r199 simple example: window = Window:Create("example",0,0,800,600) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:SetPosition(0,6,0) light = DirectionalLight:Create() light:SetRotation(45,45,0) terrain = Terrain:Create(128,true) box = Model:Box() box:SetPickMode(0) box:SetColor(1,0.5,0,1) camrot = camera:GetRotation() gx=Math:Round(context:GetWidth()/2) gy=Math:Round(context:GetHeight()/2) move = 0 strafe = 0 while window:KeyDown(Key.Escape)==false do if window:Closed() then break end mpos = window:GetMousePosition() dx = mpos.x - gx dy = mpos.y - gy camrot.x = camrot.x + dy / 10.0 camrot.y = camrot.y + dx / 10.0 camera:SetRotation(camrot) window:SetMousePosition(gx,gy) move = Math:Curve(((window:KeyDown(Key.W)and 1 or 0) - (window:KeyDown(Key.S) and 1 or 0)),move,10) strafe = Math:Curve(((window:KeyDown(Key.D)and 1 or 0) - (window:KeyDown(Key.A) and 1 or 0)),strafe,10) camera:Move(strafe,0,move) if window:MouseHit(1) then pickinfo = PickInfo() if (camera:Pick(mpos.x,mpos.y,pickinfo,0,true)) then box:SetPosition(pickinfo.position) end end Time:Update() world:Update() world:Render() context:Sync(true) end
  2. an example showing your problem would help since the API example works ok: http://www.leadwerks.com/werkspace/page/api-reference/_/shape/shapecylinder-r519 As the example shows you do not need to offset/rotate/size the shape to take into account the position/rotation/scale of the model cylinder. The SetShape() command will set the shape to the model's position/rotation/size. So just use the default parameters (0,0,0, 0,0,0, 1,1,1) when creating the shape if you want it to conform directly to its corresponding model. Change those parameters when you want the shape different from the model. Also I suggest that you use 'camera:SetDebugPhysicsMode(true)' when troubleshooting physics issues.
  3. An example of your problem would help, but the offsets (x,y,z) should be relative to the center. And if they are off by a factor of 100, then I would assume its the difference between using centimeters and meters. Personally I am not a big fan of the cm use in the editor when all the LE commands use meters for units.
  4. @cassius - you purchased when LE3 was being offered as a standalone application. That option does not exist any more and Josh converted your application to the steam equivalent which is the Indie edition (lua only) plus the Standard edition (C++ DLC).
  5. I haven't looked at the inherent monsterAI script in a long time so I do not know if there have been a lot of changes this past year for it - but the Target property in the monsterAI used to be just for making the monster go to a certain waypoint. If you set the target as the player and then moved the player prior to the monster reaching you then it would cause issues. See this old post for more detail: http://www.leadwerks.com/werkspace/topic/11527-monsterai-prefab/#entry83180
  6. macklebee

    Vegetation Demo

    70+ in grass to 300+ in sky on GT590 Looks good - even though i get the pixel flickering as well on far away trees. It's almost like your billboard creation works too well since it looks like the flickering is caused by the empty spaces between leaves/branches.
  7. Quickest way I can think of doing it inside the Editor is to set the Grid Size to 1 cm by pressing the '[' key for two of the orthographic views and then just drag the sides of the box until you have 19cm.
  8. http://www.leadwerks.com/werkspace/topic/4333-projectile-from-a-to-b/page__hl__parabola#entry37966
  9. Looks like you moved all of your textures and materials but did you open up the model and reassign the new material to the model's surface? The folder you have clicked in the assets browser is Halloween/ghost/New Folder. Thats where those textures are located now. So you have to go back and rebuild the material to make that the location the textures are being referenced from. Then you will need to open the model and make sure that newly created material is applied to it and saved. You can't just move files around and expect assets that referenced previous file locations to automatically know that.
  10. Just set a uniform through code as the mix interpolation value - it doesn't have to be fixed. Example shader: mix.zip Example script that shows how it works: window = Window:Create("mix textures",0,0,800,600) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:SetPosition(0,0,-2) light = DirectionalLight:Create() light:SetRotation(35,35,0) mixshader = Shader:Load("Shaders/Model/mix.shader") texture0 = Texture:Load("Materials/Developer/bluegrid.tex") texture1 = Texture:Load("Materials/Developer/leadwerks.tex") mixmat = Material:Create() mixmat:SetTexture(texture0,0) mixmat:SetTexture(texture1,1) mixmat:SetShader(mixshader) box = Model:Box() box:SetMaterial(mixmat) mixture = 0.0 toggle = 0.007 while window:KeyDown(Key.Escape)==false do box:Turn(0.5,0.5,0.3) mixture = mixture + toggle if mixture>=1.0 then toggle = -0.007 end if mixture<=0.0 then toggle = 0.007 end mixshader:SetFloat("mixture",mixture) Time:Update() world:Update() world:Render() context:SetBlendMode(1) context:DrawText(string.format("Mixture: %.2f",mixture), 2 ,2) context:SetBlendMode(0) context:Sync(true) end Note: keep mixture value between 0.0 and 1.0
  11. It is and always has been since he released it in 2014
  12. As reported by Einlander here: http://www.leadwerks.com/werkspace/topic/13428-fbx-importer-not-importing-more-than-two-map-channels/#entry94367. The Model Editor strips the vertex colors when you save the model. This is a user-clickable option in the TOOLS menu, but just saving the model will remove the vertex colors. Here is example model with vertex colors applied: ellipsoid1.mdl If opened in Model Editor and saved - it will remove the vertex colors.
  13. http://www.leadwerks.com/werkspace/topic/12444-importing-fbx-as-black-mdl/#entry90101 hmmm - it looks like vertex colors are being stripped no matter what - even though its a user-clickable option in the model editor. This is a separate bug report.
  14. Context:DrawImage() already gives you the ability to scale the image. For mirrored images, you just need to use the negative of the image's vertex X and/or Y coords. Rotating an image requires a little more shader programming - I have used this several times myself as shown here: http://www.leadwerks.com/werkspace/page/viewitem?fileid=317982413 A modified drawimage shader that does what you are asking for: drawimage_enhanced.zip Example of how to use: window = Window:Create("draw mirrored or rotated image",0,0,800,600) context = Context:Create(window) imageshader = Shader:Load("Shaders/Drawing/drawimage_enhanced.shader") image = Texture:Load("Materials/Developer/leadwerks.tex") angle = 0 while window:KeyDown(Key.Escape)==false do angle = angle +1 context:SetColor(1,0,1) context:Clear() context:SetColor(1,1,1) oldshader = context:GetShader() -- capture default context shader context:SetShader(imageshader) -- set the image shader imageshader:SetFloat("angle", 0) -- set angle to default imageshader:SetVec2("pivotposition", Vec2(0.0,0.0)) -- set pivot to default imageshader:SetInt("flip", 0) -- set flip to default context:DrawImage(image,0,0,400,300) -- draw normal image imageshader:SetInt("flip", 3) -- mirror in X&Y context:DrawImage(image,400,300,400,300) --draw flipped image imageshader:SetFloat("angle", angle) -- set varying angle imageshader:SetVec2("pivotposition", Vec2(100.0,100.0)) --set pivot to center of image imageshader:SetInt("flip", 0) -- set flip for normal drawing context:DrawImage(image,300,200,200,200) -- draw rotating image context:SetShader(oldshader) -- set back to default context shader context:Sync(true) end Options for "flip": 0 = normal 1 = X flipped 2 = Y flipped 3 = X & Y flipped Note: use un-clamped textures if flipping the image with this shader.
  15. It appears to work for me. We might have to see your script to determine what the problem could be. window = Window:Create("sprite",0,0,800,600) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:Move(0,0,-3) sprite = Sprite:Create() local material = Material:Load("Materials/Effects/tracer.mat") sprite:SetMaterial(material) sprite:SetSize(0.25,5.25) while window:KeyDown(Key.Escape)==false do if window:KeyHit(Key.Space)==true then sprite:Release() end Time:Update() world:Update() world:Render() context:Sync() end
  16. Window:GetMousePosition() This function gets the mouse position. The X and Y components of the returned values are the screen coordinates, and the Z component is the mouse wheel position. example: window = Window:Create("crosshair",0,0,800,600,window.Titlebar+window.Center) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:Move(0,0,-3) light = DirectionalLight:Create() light:SetRotation(35,35,0) model = Model:Box() model:SetColor(1,.5,0,1) crosshair = Texture:Load("Materials/Crosshair/crosshair.tex") ch_width = crosshair:GetWidth() ch_height = crosshair:GetHeight() --window:HideMouse() while window:KeyDown(Key.Escape)==false do model:Turn(0,Time:GetSpeed(),0) Time:Update() world:Update() world:Render() m_pos = window:GetMousePosition() context:SetBlendMode(Blend.Alpha) context:DrawImage(crosshair, m_pos.x - (ch_width/2), m_pos.y - (ch_height/2)) context:DrawText("Mouse position: "..m_pos.x..", "..m_pos.y, 2, 2) context:SetBlendMode(Blend.Solid) context:Sync() end
  17. You have to take into account the width/height of the image as well if you are trying to center it. so essentially (psuedocode): context_w = Context:GetWidth() context_h = Context:GetHeight() image_w = Texture:GetWidth() image_h = Texture:GetHeight() Context:DrawImage( image, (context_w - image_w) / 2 , (context_h - image_h) / 2, image_w, image_h )
  18. macklebee

    Billboards Part 2

    Will you add terrain shadows along with this? That feature would definitely help make the LE terrains look more realistic. Right now they just look 'off' without it.
  19. You never respond to the multiple bug reports that you post for this problem. Josh has tried to help you multiple times but you never supply the information he requests or you just stop responding. Not quite sure what you expect anyone to do for you if you don't respond to the one person that can solve your problem. http://www.leadwerks.com/werkspace/topic/11050-microsoft-visual-c-runtime-library-error-on-startup/#entry80545 http://www.leadwerks.com/werkspace/topic/11058-exception-violation-error/#entry80600 http://www.leadwerks.com/werkspace/topic/13167-failure-to-launch/#entry93103
  20. Its because the default shader calculates the cubemap colors combined with the specular texture but then never does anything with that variable ('emissions'). Another thing to consider is that the texture slot for the cubemap is texture 5. Also, keep in mind that there is no default env shader for animated models.
  21. Yes agree - this was something Aggror and I discussed over a year ago. The default FPS script is nice for those who don't want to code but yet it has some rudimentary features. But for a person who is trying to learn the basics, that script would be a little daunting. I personally liked the way Josh had done the tutorials in LE2 as nice basic packages. There was a tutorial on just camera movement that broke down the code down in nice easy chunks.
  22. Isn't that exactly what entity:SetKeyValue() does?
  23. got to love bmax to be able to just whip up a useful application
  24. dont do a polymesh but make a simple cylinder physics shape for the tree trunk?
  25. Yes. Edit - I assume you want more than that, so here is a version that Gimpy did for LE2 back in the day. You should be able to convert it to LE3 code fairly easy. http://www.leadwerks.com/werkspace/topic/1762-pointnclick/
×
×
  • Create New...