Jump to content

macklebee

Members
  • Posts

    3,946
  • Joined

  • Last visited

Posts posted by macklebee

  1. 13 hours ago, Thirsty Panther said:

    local mhit = window:MouseDown(Key.MButton)

    This code lets me know the Middle button is pressed but how do I get the Left - Right information at the same time?

    Just like you would for any other time for the camera rotation but make the middle mouse button the qualifier for allowing the camera to rotate. Look at the orbital camera example I posted almost two years ago for an example: 

    Here's the same code updated to show the use with middle mouse button instead of the right mouse button:

    window = Window:Create("Orbital Camera",0,0,800,600,Window.Titlebar+Window.Center)
    context = Context:Create(window)
    world = World:Create()
    camera = Camera:Create()
    camera:SetSkybox("Materials/Sky/skybox_texture.tex")
    light = DirectionalLight:Create()
    light:SetRotation(35,35,0)
    
    player = Model:Load("Models/Characters/generic/generic.mdl")
    player:SetColor(0,1,0,1)
    pivot = Pivot:Create()
    pivot:SetPosition(0,0.8,0)
    camera:SetParent(pivot)
    camera:Move(0,1,-3)
    
    mx = 0
    my = 0
    prevmx = 0
    prevmy = 0
    toggle = 0
    
    while window:KeyDown(Key.Escape)==false do
    	if window:Closed() then break end
    	if window:MouseHit(Key.MButton) then toggle = 1 end
    	if window:MouseDown(Key.MButton) then
    		mousepos = window:GetMousePosition()
    		mx = pivot:GetRotation().x + (mousepos.y-prevmy)
    		my = pivot:GetRotation().y + (mousepos.x-prevmx)
    		if toggle==1 then
    			toggle = 0
    			mx = pivot:GetRotation().x
    			my = pivot:GetRotation().y
    		end
    		pivot:SetRotation(mx,my,pivot:GetRotation().z)
    		prevmx = mousepos.x
    		prevmy = mousepos.y
    	end
    
    	Time:Update()
    	world:Update()
    	world:Render()
    	context:SetBlendMode(Blend.Alpha)
    	context:DrawText(string.format("FPS: %.1f",Time:UPS()), 2, 2)
    	context:DrawText("Hold Middle Mouse Button Down to Rotate", 2, 22)
    	context:SetBlendMode(Blend.Solid)
    	context:Sync(true)
    end

     

    • Like 1
  2. 4 minutes ago, CangoJoe said:

    Ok cool thanks,

    I'm just trying to wrap my head around the purpose of DrawRect()  in your sample.

    All I am doing is drawing a rectangle the same size as the window/context and fading to black/white by just adjusting the alpha component in the rectangle's color settings.

  3. Just in case you do not realize, but there is a search function built into the forum. I think you will find it helps answer a lot of questions. The following are from just typing 'vehicle' into the search... note that vehicles have been in the process of being reworked for quite awhile now and may not be stable.

     

    • Thanks 1
  4. Without an example map to try all we can do is guess. Help us to help you...

    But these are my guesses:

    1) Are you by chance using posteffect shaders in your game, like bloom, that would cause any blurring?

    2) I wonder if the texture quality in game is being set by default to a lower resolution than what is by default being used in the editor? Refer to this post for information:

    3) Also, if that does not resolve it, take a look at some of the other settings: 

     

    • Thanks 1
  5. 10 hours ago, martyj said:

    The entity that cannot be found is a Box.

    The entity that can b e found is a Pivot
     

    I've updated my sample to reflect the topic.

    I wrote my own FindEntity function to try to see if there is a bug in the World's FindEntity. It just loops through the world entities calling World::GetEntity(n) and compares the name.

    Both my version and the LE version have the same problem, I'd imagine they are along the same lines of code.

    good to know - without that info about your own function it makes people guess at the problem.

    when you say the entity that cannot be found is a Box are you referring to a CSG created box or an actual model that has been imported? Because like Aggror has asked/implied about twice now: if that entity is a CSG created box that you made in the LE world editor and you do not have the mass set greater than 0 or a lua script attached, then that CSG brush will be collapsed into one object with all the other mass-less, script-less CSG objects in the world which would prevent you from finding it via the "name" key.

    If for some reason this is an imported model or you have set mass or script to a CSG created box, then I would suggest posting  an example map and sample code so others can try to replicate the issue.

  6. App:FindEntity("EndAsdfgwg")

    why are you doing App:FindEntity()? shouldn't it be 'world:FindEntity()' since you went to the trouble of finding the current world and thats the title of your topic? And are you for some reason still using the very depreciated app.lua scripting?

  7. I remember a similar issue that baffled many a person years ago with a inherent LE2 underground tunnels prop that prevented the player from moving over a very small bump on the floor. The height of it should have not caused the player any issues moving over it. What it turned out to be was that if you zoomed way in to see the profile of this small bump, its face angled in such a way that the player controller was interpreting the face as a slope too great for the controller to climb.I think the fix was to clean up the angle and it seemed to work properly after that. 

    Edit - if memory serves there was another issue with one of the underground tunnels props as well where a particular corner of the tunnel prop had alot of geometry all happening in a very small - almost pin size- area. So when a controller would walk over it, it would randomly sligshot the controller all over the room.  Anywho - my suggestion is to check the model especially if you are building your physics shape off of it.  I would suggest keeping the physic shapes as simple as you can.

  8. You did not make a Leadwerks material like mentioned and linked to above.

    To make a material, right click on the imported texture and select 'Generate Material'. Double-click the new material and add your textures and shaders to the material and save. Once you have the material created and you have imported the model into LE, double-click the model and it will open the Leadwerks Model Editor. You can attach your material to the model under the listed surface in the mesh hierarchy tab. 

     

    See the tutorials about models and materials:

    https://www.leadwerks.com/learn?page=Tutorials_Editor_Materials

    https://www.leadwerks.com/learn?page=Tutorials_Editor_Models-and-Animation

     

    Suggest you read all of the official tutorials as there is a lot of useful information available.

    materialcreation.thumb.jpg.fc1537011ee21351540ebd300e5e81d2.jpg

     

     

    modeladdmaterial.jpg

    • Upvote 1
  9. 12 hours ago, Josh said:

    Custom post-process effects are attached to a camera.  I do not understand how a geometry shader relates to this.

    Thats because my custom geometry shaders use Draw()-related commands. So you are saying something as simple as text now will require a sprite? Sounds very counter-intuitive. How will custom buffers be supported? Or are they going to be officially supported finally in LE5? 

    • Upvote 1
  10. 15 hours ago, Josh said:

    Note there is no call the context::Sync because once you start the world render, it goes off on a separate thread and goes out all the way to the monitor.  There are no drawing commands you can call after that.  I think we're going to have a system of persistent 2D sprites you create, rather than drawing commands you call.

    The Render command itself only passes any changed positions to the culling thread and returns to your program, so there is really nothing to slow your game code down and if the timing isn't limited it will execute at like 1000 updates per second.

    er - what? you need then to give access to the render thread so we can use drawing commands. All custom post-process and geometry shaders would be affected by this, would they not? A 2D sprite doesnt isnt quite the same. So you are saying GUI's now will all be sprites?

    • Upvote 2
×
×
  • Create New...