Jump to content

Lunarovich

Members
  • Posts

    166
  • Joined

  • Last visited

Everything posted by Lunarovich

  1. Thanks macklebee. And thanx everyone for all the explanations. Seems quite clearer now
  2. @CreativeOcclusion, thanx! But I was talking rather about folder name and the name in the project manager... Is there a way to change it? 'Cause I don't see any option in the project manager to rename a project and I suppose that I cannot simply change the name of the folder...
  3. I know that it's a stupid question, but is there a way to change a project name in Leadwerks? Some automated way that changes all relevant filenames from the root folder? Or can I just change the name of the executable?
  4. Thank you for the answer. However, the fact that I can get more or less better results does not confort me. I expect it to be either a collision with a named entity or no collision at all. I know that I can check if entity ~= nil, but is there a more elegant way that always gives me intended results?
  5. Hello, can anyone give me a hint or a link that explains how to create Lua classes similar to those built into Leadwerks? For example, Leadwerks has a Model class, and you can do a Model:Create() in order to create a new model. I would like to have my custom classes, eg. Block, with a method Block:Create(). I know that Lua classes are, in fact, made in C++ and disposed via Lua interface. I have a Leadwerks standard edition, but would prefer not to fiddle at this point with C++ (which I've, BTW, learned, so I can use it). But if it's necessary, I would gladly ask for some hint/advice where to start. Thanks in advance!
  6. Hello! I think I understand the meaning and use of other blend modes (solid, alpha, light and invisible). But what are blend modes shader and mod2x and when do we use them. BTW, the relevant command reference page should add Blend::Invisible to the current list of Blend types.
  7. When the player first hits the "Death trigger" (which is Collision.Trigger), the Entity:GetKeyValue("name") outputs a correct value, ie. "Death Trigger, however, player's speed is 0 for some reason in that and a subsequent tick... Then player gets teleported (via SetPosition) to the respawn point. In the meantime, its speed is about 25 as it should have been when he hits the trigger... Since now the player collides with a normal ground and not a trigger, he dies. Why would the speed be 0 when he hits a trigger? And how comes that an Entity:GetKeyValue("name") is an empty string in all subsequent ticks when a Script:Collision gets called? I mean, aren't we supposed to always collide with an entity and doesn't all entities have names? EDIT: It seems to me that I have a general problem with the Entity:GetKeyValue("name"). I've pinned the problem down to the fact that entity:GetKeyValue("name") sometimes returns an empty string inside the Script:Collision, which I don't understand, as I've explained in the previous paragraph.
  8. Admittedly bad semantics. It's not supposed to be a death trigger. It's a spawn trigger. So, I wouldn't like to get killed when hitting it hard So ~= should stay. Anyway, this is not something that puzzles me. It's a suite of behaviors described in EDITs of post 3.
  9. Thanks! When I try it, the System:Print outputs a correct value, ie. Death Trigger, to the console, but the code still doesn't work. Anyway, why do I have to use tostring function. Isn't Entity:GetKeyValue supposed to give me the value that I'm looking for, ie. of type string? EDIT: I've just checked with the type(entity:GetKeyValue("name")) and it does give me a string... This one puzzles me... EDIT: OK, this one, for some reason, works: local name = entity:GetKeyValue("name") System:Print(name) However, this one still does not work if speed>20 and name ~= "Death Trigger" then self:Hurt(100) end even though the name gets the correct value, ie. "Death Trigger" outside the if condition. Inside the if condition, name seems to be an empty string... How strange... At least for me Am I missing something about Lua lexical scoping??? EDIT: It seems that I am trying to call a GetKeyValue on a non-existing entity. Not yet sure, though.
  10. Hello, this one is "hurting" me Here is an error message that referes to the System:Print() call: error in function 'Print'.; argument #3 is 'string'; '[no object]' expected. function Script:Collision(entity,position,normal,speed) System:Print(entity:GetKeyValue("name")) if speed>20 and entity:GetKeyValue("name") ~= "Death Trigger" then self:Hurt(100) end end Also, the condition in the third line does not work, although I have an object that is called "Death Trigger" and the script gets activated when I hit it... BTW, don't know what is a third argument of the Print. Also, what does the "'[no object]' expected" means?
  11. Thanks! Is a static scene geometry, as you've said, an object of its own kind or is it a static model, ie. a rigid body entitiy with a mass 0? I mean, I know I'm pestering a bit with this question, but no one seems to give me the final answer...
  12. I was going through this and he says that you need to give non-zero mass or attach a script to the CSG object in order to turn it into entity. Concerning what Josh have said, maybe he should have added, an entity with a separate surface, since large models made out of CSG are geometries turned into entities silently by Leadwerks, as I believe. P.S. Maybe I'm overdoing it, but it's just my cartesian need to have a clear and distinct understanding of the subject matter
  13. I've already corrected/edited the post #5 and said in post #9 that adding scripts to same instances of models do not make models have separate materials. So, their behavior is expected and explained (which puts my mind at ease). However, the question remains in respect to CSG. Why does adding scripts works in the case of objects made using brushes? And why random group of these objects react in the same manner - get / do not get the assigned material - on material change (via mouse picking, which is inessential here)? Does it stem from the fact that Leadwerks converts CSG objects with scripts, under the hood and in the runtime / on the map creation, into separate models, ie. models with separate surfaces?
  14. Here, I have cubes made out of brushes with scripts attached to every cube: It works really neat in the game. Just as expected. I can turn on/off individual cubes with camera mouse picking. If I make a prefab out of the single cube (made using CSG, ie. brushes), it still works as intended. However, it does not work with models (even if I attach scripts to them). This agrees with what Josh has said: But why does it work then with prefabs (with scripts attached)? Aren't prefabs made out of brushes internally turned into models? And finally, why does it work with individual pieces of CSGs with scripts attached? P.S. Josh, thanks for this nice framework. Really enjoying it! Haven't found a 3D framework so transparent and so easy to use, but still not simplistic a bit... And I've tried a lot of them
  15. Yeah, adding scripts effectively solved the issue with models (EDIT: with prefabs made out of brushes) as well as with brushes. Thanks! Is there some logical reason why adding scripts would help in this case? Does adding script do some under the hood "individualization" of the object? If yes, in what exactly consists this individualization? P.S. Sorry for philosophical terms. I'm a philosopher by profession
  16. I've tried to release a cube upon picking it, and the engine released every other connected cube. It probably has to do something with the way brushes work. I'm testing the behavior on the models right now... Just tested it. I get the same behavior with models and with prefabs.
  17. Hello! I'm puzzled by the SetMaterial() behavior. I have a scene with randomly disposed cubes made in the editor. When I do the mouse pick on a cube, I check its material, and switch/toggle the material of the cube. I have two separate materials, one with and the other without the emission texture/shader. Now, when I pick the closest cube and toggle its material, some of the other cubes (but not all) get the same material. Sometimes only one cube switches material, sometimes two or more. Everytime the same group of cubes react to the single cube picking/material setting, so apparently that's not something random. For the sake of completeness, I have tried to make individual cubes both with brushes and CTRL-axis drag & drop. The result is similar. Now, I suppose that this behavior has something to do with the Entity:Instance() VS Entity:Copy(). But could be totally wrong N.B. I use the closest entity option in the Pick routine. Here is my pick routine: local window = Window:GetCurrent() local context = Context:GetCurrent() if (window:MouseHit(1)) then local pickinfo = PickInfo() if (self.camera:Pick(context:GetWidth() / 2, context:GetHeight() / 2,pickinfo,0,true)) then if (pickinfo.entity:GetMaterial() == self.blokMatNormal) then pickinfo.entity:SetMaterial(self.blokMatEmissive) else pickinfo.entity:SetMaterial(self.blokMatNormal) end end end
  18. @Olby I agree completely. I've started using Leadwerks only yesterday. Learned a bunch of things in a day (Lua syntax, engine program's flow and API basics). Never seen an engine so transparent, so logical and yet not sipmlistic. Best engine I've used so far, definitely. That said, editor feels really clunky. No window autofocus on tab switch (always have to focus a window with a additional mouse click), as you've said, no autocomplete, even the CTRL - arrows for text navigation does not work as is case with every text editing app that I know! I've started using Atom io with a lua-language package. The only downside is that it does not color semantically valid constructs.
  19. Hello! This one's driving me crazy. I can't simply understand why I get an attempt to call method 'setPosition' (a nil value) et the entity:setPosition(spawnPos) This two lines print(entity:GetKeyValue("name")) print(self.respawnPoint:GetKeyValue("name")) give me a desired output: Player name Spawn point name Here is the code... Script.respawnPoint = "" --entity "Respawn point" function Script:Collision(entity, position, normal, speed) if (entity:GetKeyValue("name") == "Player") then spawnPos = self.respawnPoint:GetPosition() print(entity:GetKeyValue("name")) print(self.respawnPoint:GetKeyValue("name")) entity:setPosition(spawnPos) end end It seems to me that in the editor everything is setup correctly:
  20. This one worked for me. It's a temporary fix as far as I've read here Now everything works...
  21. Well, I have exactly the same issue with the R6025 virtual function call. So, he's not the only one I try to run it on WIndows 7, 64 bit. NB: I have Windows 8 installed on the other computer, and everything works OK.
×
×
  • Create New...