-
Posts
7,936 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Rick
-
Yeah, prefabs are supposed to do that and Prefab:Load() will load a new instance. However, I'm finding that it doesn't seem to be running the scripts (even though I told it to load the scripts as well in the second param to the Load function). I'm working on a PrefabFactory that you pass in a prefab file and it'll create an instance of whatever you pass in (like a goblin).
-
What spawner script are you looking at?
-
[LE3] Script:Collision only runs when moving?
Rick replied to Rick's topic in Leadwerks Engine Bug Reports
I could. Just seems strange because the 2 bodies are still colliding even if they aren't moving. Also, if the player moves out of the volume they shouldn't be teleported. If I set a flag in Collision() of the entity, then they move out of the teleport, they would still get sent. Would need a way to tell when the player left. Unity has an OnCollisionExit() which would be nice in LE. -
I'm creating a PrefabFactory script where you fill out a property of the prefab file and destination. I'm testing with the goblin and I'm able to create a goblin but it just sits there. If I pass 0 as the 2nd param to Prefab:Load() I get an error because the scripts don't seem to get loaded. If I pass a 1, like below, I don't get the error, the goblin model is where it's supposed to be, but it's not animating or doing anything so it doesn't seem like the scripts are really getting executed. Not sure if this is a bug or what? The script source is: Script.prefabFile = ""--string "Prefab File" Script.destination = nil--entity "Destination" function Script:Start() end function Script:CreatePrefab()--in self.entity = Prefab:Load(self.prefabFile, 1) self.entity:SetPosition(self.destination:GetPosition()) end
-
At the bottom of the following page it talks about argument functions for the flowgraph. http://www.leadwerks.com/werkspace/page/documentation/_/user-guide/object-scripts-r631 Does anyone know how to define these argument functions in Lua?
-
I've created a TeleportTrigger. It uses a timer inside the Collision() function to trigger an output on a delay. ie. you stand in the teleport and in 2 seconds it ports you to another spot. This all works great except for 1 thing. If I stand still with the character it doesn't trigger the Collision() function. The way I see if, just because the character controller is not moving doesn't mean it's still not colliding. If 2 bodies are inside each other I would expect Collision() to be called continuously, but that's not the case.
-
The above is far from a full game. It's one interaction/event in the level and it could use it's own module for organization. This is no different than programming. Organization is needed to keep things easy to read and cleaner. Also Josh is at a point where he doesn't see the full benefit of a flowgraph. At one point he also didn't see the full benefit of his engine being in C++, but he does now. That's what all those scripts above are. They are scripts attached to entities. I agree. However, that doesn't mean that script can't fire some outputs and have some inputs for other stuff. Like my modification to player.lua that enables/disable input. If you have a cut scene in your game you'll want to be able to trigger that.
-
OK, I changed the shape to be slightly smaller than the csg model and it works. When I activate gravity on them the game gets really choppy. Not sure why that is.
-
I create a csg box. 1,2.5,1. Physics mode: Rigid Body; Shape: Box. Fit Shape pressed. Mas: 10; Collision Type Prop. Everything else default. I would think this is pretty basic setup. The error I get is: \Source\Libraries\NewtonDynamics\coreLibrary_300\source\physics\dgCollisionConvex.cpp line 2756.
-
I've created 6 more scripts for the flowgraph. 1 is cinema bars, another is a way to start things off in the flowgraph when the scene is loaded, another is just a passthrough, and the others are variations of Random. In this example video I've combined 6 of my scripts (SceneLoaded, Sound, CinemaBars, Timer, Random3, & PassThrough) and changed the Player script for DA to enable/disable input to create this effect. Below is the flowgraph that made this interaction. I add a delay timer so that it gives the scene time to show itself for a second or so before we play the sound and give back input control to the player. Description: Follow the flow left to right. It all starts with SceneLoaded node. That disables the player input and shows the cinema bars. Show will trigger it's output which enables the timer to give us a 1 second buffer to show the scene. When the timer ticks (1 second in this case) it disables itself and then goes into the In of Random3, which will fire 1 of the 3 outputs. All 3 outputs go to their own sounds. When either are completed it goes through what I'm calling a PassThrough. This is just a nicer way to organize things and will pass the flow right through. The PassThrough Out output then hides the cinema bars and enables the player. Without the PassThrough we'd have way more lines because OnComplete to each sound would have to enable player input and hide cinema bars. I think when using Random nodes PassThroughs can help keep things cleaner as the flow comes back together. http://www.leadwerks.../videos/_/-r201 I would love to see modules and comments in the flowgraph. When things get complex, just like in any other language, we need better ways to organize them. We wouldn't put everything inside int main() and the same would hold true for flowgraphs. I would put this entire section into it's own module and the module would have a visual node itself that I would put into the main flowgraph to show it should run that module. Ideally I think when inside a module it would have a Start node that has an output called Run or something that we can hook up to start the flow of that module. This and comments would really help organize the flowgraphs.
-
I think you forgot to seed because Math:Rnd() is returning the exact same number every time I run the game.
-
Does anyone know how to get the graphics width and/or height? Can't see to find it in the docs. [EDIT] App.context:GetWidth() Doesn't seem to be documented though. http://www.leadwerks...erence/context/
-
OK, guess I'll have to make my hide/show script handle both the visual model and the collision type.
-
I like it. We could make a joint and have big swinging axes be activated as a trap!
-
@Cassius There is and I could hide the model AND change the collision, but just seems like if we hide the model then it should also disable the collision since we have the invisible material for the other thing. In LE2 if your physics were a child of the model then hiding the model I'm pretty sure would hide the physics entity and make it not work. How specifically did you have your door setup?
-
As far as I could tell the "best" way to do the hidden and collision would be to put the invisible material on it. We do need a way to completely "disable" models though and hidden used to do that, and I guess I would think it still should.
-
I was under the impression that if an entity is hidden, you cannot collide with it? I thought the invisible material is how you would do something like this if you wanted that functionality. I want a doorway to be blocked by some CSG models when a trigger is hit. So I hide them at first but because they have a shape and collision type of prop or scene I still collide with them. I'm pretty sure this isn't how it works in LE2 and so have to assume this is a bug.
-
[LE3] hidden flag in editor doesn't seem to work
Rick posted a topic in Leadwerks Engine Bug Reports
If I mark something as hidden in the editor, and then run DA that entity is still visible. -
http://www.leadwerks.com/werkspace/files/file/413-le3-volume-trigger/ A simple volume trigger. Attach it to any CSG model and when anything collides it triggers the OnCollide. I do plan to enhance this one with more options at a later time.
-
Gives a nice camera shake effect. Attach to your camera and call it's Shake() input. http://www.leadwerks.com/werkspace/files/file/414-le3-camera-shake/ The result is shown here: http://www.leadwerks.com/werkspace/page/videos/_/-r196
-
The thing is it doesn't even hit the Script:Collision() function. I put a break point right away in the function and it never gets there, so it never has the chance to call any outputs or do anything. The fact that it does exit on collide almost points to maybe the Collision() function isn't defined correctly or something, but I copied from the doc (not that it can't be wrong in the docs). The docs talk about a collision trigger script that should come with the engine (http://www.leadwerks.com/werkspace/page/documentation/_/script-reference/collisiontrigger-r702). Does anyone have this? I don't seem to have it, but I could have deleted it I guess.
-
I don't know the details 100% on the flowgraph behind the scenes. Josh would have to answer that. I have lots of things planned
-
So I'm trying to create a volume trigger. I have the following lua file: Script.triggerEntity=nil--entity "Trigger Entity" function Script:Collision(entity, position, normal, speed) if self.triggerEntity ~= nil then if self.triggerEntity == entity then self.component:CallOutputs("OnCollide") end else self.component:CallOutputs("OnCollide") end end function Script:OnCollide() end I make a box csg. I give it the invisible material. For physics I have it as Rigid Body, shape is box, clicked fit shape, set collision type to Trigger, and unchecked nav obstacle. For the script I dragged the Barbarian entity as the triggerEntity. When the Barbarian collides the game crashes. The Collision() function does not get hit (I have a breakpoint in there). Any ideas why it would crash? The editor doesn't crash just the game. The only thing in the console reads: Error: Unknown client disconnected (in red)
-
http://www.leadwerks.com/werkspace/files/file/412-le3-timer-node/ Create pivot, attach script, set properties, add to flowgraph. If OnTick output calls it's own Disable() then this can act as a delay node as well.