Jump to content

mdgunn

Members
  • Posts

    626
  • Joined

  • Last visited

Posts posted by mdgunn

  1. Never tried it but there is a sprite object and you will be able to make it point always at player.

    Your enemies can probably use a modified version of the monsterAI script (in Assets/Script/AI). You can then use the states it has defined to switch animated textures on your sprite maybe (e.g. idling, attacking,dying). You should be able to control the speed the animation frames are switching using the time commands.

     

    This may help you get a test going with animated textures:

    http://www.leadwerks.com/werkspace/topic/11848-need-help-with-animated-textures/page__hl__animated+textures

     

    This is jsut the first things coming to mind. Somones who's actually tried it may have a better idea! :)

  2. If you didn't try modifying the mass yet then I would try that. I usually just set player to 10 (but my games are probably not the same as yours so it's not that that is the BEST value or anything). Try the enemy at the same mass as the player and them maybe double it or more if still problems. Just to see what happens. The physics system is really trying to simulate 'simplified' but proper physics, and the relative masses of things can be important.

     

    I suggest checking the mass setttings of player and enemy on the FPS Sample.

     

    When things bounce away and 'teleport' it is usually because the physics are doing the 'correct' calculation and bouncing away the strangely VERY LIGHT (though very large!) concrete block(!) or whatever.

     

    Physics can be a frustrating area so keep at it and I'm sure we'll sort it.

     

    Supplying the model and map for Josh will surely do the trick.

  3. I'm considering implementing some water in a level in the form of waterfalls, stream or small pools (not necessarily at a single fixed level like the water plain).

     

    A few questions relating to this:-

     

    1) How would people go about doing a waterfall?

    I'm thinking an animated texture with a refraction shader and maybe some particles (for splash) as I've seen done in Source engine

    (https://developer.valvesoftware.com/wiki/Creating_a_Waterfall_Material)

     

    2) Is there a refraction shader available that would work for water (like they use in the tutorial linked above)? I see some refraction code in the water shader but I'm not sure whether to try and make that water shader work on a brush/model or start from scratch. I've never constructed any shaders so this feels like it might be difficult for me to do.

     

    I tried getting some water pools working by using the animated water image files on a new material but couldn't get it looking much like water at all.

     

    Anyone got some experience on getting better water (waterfalle/streams/pools).

  4. Fiddling about unparenting things in the tree feels quite clunky. I often find myself dropping children somewhere I don't actually want it just so I can scroll around and try to move it to where I really want it. It can really bring you out of 'using the software as a tool' mode and into 'OK how do I get these tree nodes where I want them' mode.

     

    I hope this change makes it in soon.

    • Upvote 2
  5. There are 2 main ways to simplify a front-end for your game.

     

    FlowGUI - http://www.aggrortutorials.com/index.php/store/product/1-flowgui

    Not free but I bought it when I needed something done quick and it worked fine for what I was after and was quick to set up. It's not been updated for a while, but it had had several revisions and is not incomplete or half done. Also includes inventory item support.

     

    LEX template - http://www.leadwerks.com/werkspace/topic/13171-leadwerks-extended-executable-template/page__hl__template

    Free - Not used it yet but I intend to give it a try. Maybe try that and see if it does what you want.

  6. It seems it would be good if Select Object and Select Face had short cut keys (and should be an easy change - right?). Maybe 'F' for face mode and G for object mode? Not really thought what would be best.

     

    This may be more of a problem for me than others but in the levels I'm building you can see many sides of some blocks so I'm often wanting to align them all at once.

     

    Actually thinking about it, my actual issue is that I want to align textures on all faces so I select 'Select Object' then 'Select Face' so I can make the texture dialog appear. If it already showed when I was in 'Select Object' then I wouldn't need to move back to tool panel and switch tools and so wouldn't need them on hot keys so much anyway!

     

    Am I missing the reason why this panel shouldn't show in object select mode?

     

    Having it showing in object mode would also solve the 'hidden' nature of the texture panel. I think if you're new to Leadwerks then it isn't obvious that to access texture control you need to be in face mode. I realise it is actually kind of a face based tool but when all faces are selected (object mode) it works fine too.

     

    Anyway, I'm a big fan of being able to drive a program with keys so you can switch tools/settings with keys and keep mouse on your work (map/object whatever).

     

    Ideally I'd like everything to be configurable to your choice of keys.

    • Upvote 1
  7. With regards to the bullets going right through? You may need to assign collision types to items in the model tree of your NPC model. It seems even the crawler NPC does not have these set up and they have manually(?) been set up in the FPS Sample AI demo map.

     

    My suggestion would be to create a project based on the FPS Sample and take a close look at the crawler setup in the 'AI' map there. in particular, take a look at the collisions setup on the tree of the crawler model.

     

    Hope you figure it out.

  8. Thanks Shadmar. I'd tried changing some of the other values in that section before, but not ctime. It goes right to left now and away from me which is better. I wish I could make it go any way I'd choose which after some more fiddling I've not sorted, but it's great that it now better matches the way I'd setup the level.

     

    This is a fantastic shader and prefab/map. Not sure why it isn't yet visible in the public workshop section on Steam. Maybe waiting for possible changes to the how the workshop will operate?

     

    Many many thanks for your stellar work Shadmar!

  9. Does anybody know how to tweak the cloud direction? THey are coming towards and right to left in my standard setup and I really want them to come left to right ( and probably towards a little bit).

     

    I see how you can change the way the sky moves and the speed but the clouds themselves seem separate and I'd like to control them so they match the way I'm making the wind blow in the level (puffs of dust etc.). It seems a bit odd when the sky doesn't match the direction the ground wind seems to be blowwing.

     

    I COULD change my level so my wind effects match the the sky but matching the SKY to the LEVEL seems the logical way to me.

     

    I've had a look through the related lua and shader files and tried changing various values (guessing incorrectly every time) and I've never worked out which one I need to change.

     

    SO, anybody worked out how to change the cloud direction?

  10. I had the firepit working a couple of days ago and it seemed fine.

     

    Are you maybe trying to import it from a folder that is in a different project? I'm not sure if that actually is a problem but I've got a feeling I might have had an issue where i saw something similar.

     

    I would check the steam workshop dialog in the editor and see if it says Install or Uninstall. If it says installed I would still do an uninstall and install again and see if that sorts it.

  11. Yeah the CSG 'trigger' cubes and manual intervention in the movement is the direction I was heading when I wondered if I was heading the right way, so it's reassuring that you seem to think it's a doable solution. Thanks for the extra pointers.

     

    I felt sure someone had probably done a 'cube pusher' but so far someone that has completed such an implementation doesn't seem to have passed by yet.

     

    Thanks for the help.

  12. The animation shader works on a tree OK though in my test movement was very small.

     

    Do we need to use the specific shadow shader?

     

    If I select the vegetation shadow shader in the download then it doesn't seem to respect alpha but if I use the standard shadow shader that includes alpha then the leaf shadows don't seem to move at all (at leat to me).

     

    Do others see shadows moving? If yes what did you get to make the shadows move AND use alpha mask?

     

    Just checked again and the veg shader doesn't seem to have the nice appearance of the diffuse+normal+specular+alphamask. Have others got it looking great?

     

    Thanks

  13. I've hacked away at the sliding door script to create a script that moves the attatched object away as you bump into it (well you actually bump into a trigger collider currently)

     

    Problem is, it will only do it twice then stop.

     

    I think maybe the slider joint is not actually resetting when I am trying to reset it and has reached it's limit so not resetting properly. I am trying to reset it each time a move completes but I think I don't understand either how the slider works, or the vector information it needs to alter it's position or something.

     

    Can anyone take a look at the associated map and script and point out the probably obvious error?

     

    NOTE: The script is a real hack job and not meant to be complete so please forgive the mess!

     

    Here is a Dropbox link which I hope works OK. Unsure if I can link a file to this post.

     

    https://www.dropbox.com/s/3ctogtsxjf239qh/PushAwayJoint.zip?dl=0

    (contains map, script and screenshot)

    If there's a better way to supply a package then please let me know.

     

    Maybe I should try another way altogether?

     

    Thanks,

     

    Michael

  14. Thanks Josh,

     

    I had considered a joint slider. I checked out the docs and can see it is designed to limit movement in 1 direction but I wasn't sure if it was the best way to go for controlling crate movement in more than one axis.

     

    Sounds like I would still need to detect which way I'm trying to push and then setup (or disable) slider joints to allow me to push only in the direction I'm trying.

     

    I will take a deeper look.

     

    Cheers

  15. Q: What's the best way to push objects (like a crate) around and have them lock to fixed directions?

     

    E.g Push a 'crate' an undetermined distance along a path/paths but only allow it to move in fixed directions either 1 axis as if on a track or 2 axis ( e.g. 'crate' pushing puzzle).

     

    I have something working (see below) but I don't think it's the best way to go.

     

    Are there any example maps/code of pushing a crate around fixed tracks on a level. It seems like the sort of thing someone must have done but I've yet to see any examples.

     

    The problem seems to break down like this:

     

    1) Have an object to apply forces to (the 'crate') with a script to detect collision.

    2) Detect the direction of push - currently faking this with 'trigger boxes' on the side. Maybe I need some trigonometry or something to work out the side of impact between the bodies?

    3) Apply a force to the object limiting it's effect to a single axis (perhaps something in PhysicsUpdate?)

     

    At the minute I have a working example where I can push a box in 1 direction using an invisible trigger box sticking out of it on the side I want the player to push from but I think this is probably not the best way to do it and am looking for someone who knows better! :)

     

    function Script:Collision(entity, position, normal, speed)
    --    System:Print("Collision speed = "..speed)    
    --  Speed will be zero if 'trigger box' is a trigger as it needs mass 0 to avoid dropping down through floor/level.
    --    if speed>self.threshhold then
           if self.entity:GetParent() ~= nil then
               local parent = self.entity:GetParent()
               parent:AddForce(0,0,200,true)    
           end
    --    end
    end
    

     

    Thanks,

     

    Michael

  16. Thanks for the response Einlander. I think that informaiton will save me a lot of time.

     

    The player controller does a lot of special physics stuff and doesn't support any orientation except +Y = up. You'd really have to implement your own character controller with this behavior in mind.

     

    Can implementing your own controller be done fully from Lua? Do you say implement new one because the amount of changes needed in FPSPlayer would not be worth messing about with and better to build up from scratch as exactly what needed for my specifics?

     

    Thanks,

     

    Michael

  17. Thanks for the response....

     

    OK, well I tried rotating the camera to sort of fake it, and got that to hold values OK but the controls were the wrong way round (as you'd expect). I considered flipping them but at this point it felt like faking it might throw up more problems than just getting the player to rotate properly so I pursued (without success) what seemed the more sensible option of trying to rotate the player instead.

     

    Maybe I can get some answers from Josh on this. I'll see what happens,

     

    Thanks,

     

    Michael

  18. This seemed like it would be essentially a fairly simple thing to do but I can't get it to work yet.

     

    Maybe someone can tell me this is just a non-starter idea and to stop right now! :)

     

    I considered rotating the whole map and plonking the player back down again (hiding the transition) but ideally I'd like the player to do it for real.

     

    Anyway in pursuing the normal option of not rotating the map I have so far got gravity reversing OK but I can't get the player to turn around so they are actually upside down.

     

    I tried to set a rotation on the player entity Z axis but is seems to get wiped out after I set it. I guess it is later computed by something else in the normal course of things and my changes are lost.

     

    Here is my function which when called seems to set a rotation but then later lose it when I print out player rotation values in UpdateWorld() of FPSPlayer.

     

    Can anyone tell me what I need to do instead?

     

     

    function Script:FlipPlayer()--in
    if self.entity:GetKeyValue("inverted","false") == "false" then
    
     -- Get Current rotation
     playerRotation = self.entity:GetRotation()
    
     if playerRotation ~= nil then
    
       local rotx = playerRotation.x
       local roty = playerRotation.y
      -- rotate the player to be upside down
       local rotz = playerRotation.z + 180
    
      self.entity:SetRotation(Vec3(rotx, roty, rotz))
      -- Check our update held by printing it out again
      local newRot = self.entity:GetRotation(true)
      System:Print("-new playerRotation rotx="..newRot.x)
      System:Print("-new playerRotation roty="..newRot.y)
      System:Print("-new playerRotation rotz="..newRot.z)  
    
      self.entity:SetKeyValue("inverted","true")
      self.component:CallOutputs("OnFlip")
    
     end   
    end
    end
    
    

  19. He is not using the old App.lua format but the new Main.lua. But yes he could essentially perform the same by just placing a function inside the Main.lua prior to the main loop.

     

    This is the bit I don't yet understand so can someone please supply the syntax for what the function signature looks like when in Main.lua and also the specific syntax to call it from an entity.

     

     

    Thanks,

     

    Michael

  20. @Genebris I went with using a global.

     

    Personally GLOBALS make me a bit scared. I'd prefer to call a function but I still undertand how you call a function on Main.lua from an entity (or if you can). Anyone know if you can, of are you supposed to go back to the App.lua way to do it?

     

    If anyone stumbles accross this later this is how I got gravity change trigger working

     

    I added this into Main.lua

     

    --Handle Y Gravity change
    if changeYGravity~=nil then
    --System:Print("changegravity = "..tostring(changeYGravity))
    world:SetGravity(0,changeYGravity,0)
    changeYGravity = nil
    end 	
    
    

     

    And I created a script called TriggerGravityChange.lua like this (modified from map change one - you may need to change it to your needs).

     

     

    --[[
    This script will act as a trigger to change the gravity.
    This is currently triggered by a collision but you may want to have it triggered by some other means.
    ]]--
    -- positive number for Y gravity are UP!
    Script.YGravity=10--int "Y Gravity"
    Script.gravityChanged = false
    function Script:Start()
    self.enabled=true
    end
    function Script:Collision(entity, position, normal, speed)
    if self.gravityChanged~= true then
    --System:Print("Change Gravity - new value = "..self.YGravity)
     changeYGravity=self.YGravity
    self.gravityChanged= true
    end
    end
    function Script:Enable()--in
    if self.enabled==false then
    self.enabled=true
    self:CallOutputs("Enable")
    end
    end
    function Script:Disable()--in
    if self.enabled then
    self.enabled=false
    self:CallOutputs("Disable")
    end
    end
    

  21. Or you could go to your scene tab, select "root" and navigate to gravity, the deafault value is 25 but here you can only change the y value of the gravity

     

    But that would not allow be triggering it in game would it (unless I'm missing what you mean)?

  22. I want to change gravity for the world (SetGravity(x,y,x)) by triggering it from an object entity but how do I access the world object created in Main.lua? Or is there a different way to do this?

     

    Can you add functions to Main.lua that you then call from other entities?

     

    I'm confused about the change to Main.lua and how it compares to how things used to be with App.lua.

    Is there a post somewhere that went through the change to Main.lua?

     

    Thanks,

     

    Michael Gunn

  23. A material and a image based texture are two different things. If you uv unwrapped your model while in cycles render mode and used a image texture format that also works in Leadwerks, it should work.

     

    I tried again and it seemed to go better this time. I seem to be able to export cycles based UV mapped image materials and the PNGs appear now. No idea why I had the problem before yet. Probably some material setting that I'm not spotting.

     

    Thanks,

     

    Michael

×
×
  • Create New...