-
Posts
3,946 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by macklebee
-
(4.3) Child Entities Do Not Cast Shadows
macklebee replied to T0X1N's topic in Leadwerks Engine Bug Reports
This has come up before regarding child shadows, so its not new to this update. As for what you are showing above, I can have child shadows in the latest update and earlier versions if I set the parent shadow to something other than none. The only thing I can think of is what you are seeing might be related to reeplue's bug post that the latest update isn't updating shadows in the editor: http://www.leadwerks.com/werkspace/topic/15713-shadow-update-editor-issues/ . Granted, I can not reproduce what he is describing. -
(4.3) Child Entities Do Not Cast Shadows
macklebee replied to T0X1N's topic in Leadwerks Engine Bug Reports
This is not new to this update. Children objects will use the parent's shadowmode settings. The pivot inherently has SetShadowMode set to Light.None. Set the pivot shadow mode to the appropriate setting for your child object and you will see the shadow. -
I had played around with this at one time and don't quite remember everything i tried and why I ended up with the code i did, but this was the example code I had left it at: mm_pos = math.tan((90-camera:GetFOV()/2)*math.pi/180) * (mm_size/2) example script: window = Window:Create("example",0,0,800,600,Window.Titlebar+Window.Center) context = Context:Create(window) world = World:Create() skybox = Texture:Load("Materials/Sky/skybox_texture.tex") world:SetSkybox(skybox) light = DirectionalLight:Create() light:SetRotation(45,45,0) window:HideMouse() player = Prefab:Load("Prefabs/player/fpsplayer.pfb") player:SetPosition(0,6,0) camera = tolua.cast(player.script.camera, "Camera") camera:SetMultisampleMode(8) mm_size = 64.0 -- size of map mm_zoom = 0.1 mm_toggle = 0 mm_shader = Shader:Load("Shaders/Drawing/drawing_minimap.shader") mm_mask = Texture:Load("Materials/developer/mask.tex") mm_shader:SetVec2("terrain_size", Vec2(mm_size,mm_size)) --send terrain size to shader uniform cur_buffer = Buffer:GetCurrent() mm_buffer = Buffer:Create(1024,1024,1,0) -- can be any size but higher = better resolution terrain = Model:Box() terrain:SetScale(mm_size,1,mm_size) terrain:SetPosition(0,-0.5,0) terrainmat = Material:Load("Materials/developer/ash_uvgrid03.mat") terrain:SetMaterial(terrainmat) shape = Shape:Box(0,0,0, 0,0,0, mm_size,1,mm_size) terrain:SetShape(shape) shape:Release() while not window:KeyHit(Key.Escape) do if window:Closed() then return false end Time:Update() world:Update() world:Render() if mm_toggle==0 then mm_toggle = 1 camera_prev_mat = camera:GetMatrix() --calculate proper height based on camera's FOV mm_pos = math.tan((90-camera:GetFOV()/2)*math.pi/180) * (mm_size/2) camera:SetPosition(0,mm_pos,0) camera:SetRotation(90,0,0) mm_buffer:Enable() world:Render() minimap = mm_buffer:GetColorTexture(0) camera:SetMatrix(camera_prev_mat) cur_buffer:Enable() end if window:KeyHit(Key.Right) then mm_zoom = mm_zoom + 0.1 end if window:KeyHit(Key.Left) then mm_zoom = mm_zoom - 0.1 end mm_zoom = math.max(mm_zoom, 0.1) mm_zoom = math.min(mm_zoom, 1.0) context:SetBlendMode(1) context:SetColor(1,1,1,0.55) cur_shader = context:GetShader() context:SetShader(mm_shader) pos = player:GetPosition(true) mm_shader:SetVec2("player_pos", Vec2(pos.x,pos.z)) --send player's position to shader uniform mm_shader:SetVec2("zoom", Vec2(mm_zoom)) --send current zoom to shader uniform minimap:Bind(1) context:DrawImage(mm_mask,600,10,180,180) context:SetShader(cur_shader) context:SetColor(1,0,0,1) context:DrawRect(686,96,8,8,0,0) context:SetColor(1,1,1,1) context:DrawText(string.format("FPS: %.2f", Time:UPS()),2,2) context:DrawText("Player Position: "..player:GetPosition():ToString(),2,22) context:DrawText("Press LEFT/RIGHT Arrow Keys To Change Zoom",2,42) context:DrawText("Zoom: "..mm_zoom,2,62) context:SetBlendMode(0) context:Sync(true) end drawing_minimap.shader
-
That's all well and good but as pointed out in the steam forum post- which ones are 3rd party and which ones are TGC? Unless I am missing something in the zip files, there is nothing that indicates either way. I previously own several TGC packs from years ago and this was never an issue, so this is pretty disappointing.
-
Agree - that would be odd as it was never an issue prior with the TGC FPSC packs. And if that has changed, then there needs to be a disclosure on the download page or in the downloads themselves that states this is the case. So far, I am not seeing one.
-
Pretty much. LE2's Editor had an altitude setting that let you bump the imported heightmap up and down but still you never could go below 0.
-
I suspect your imported heightmap results in a terrain above 0 on the Y-axis. LE as far as I can remember has never let you go below 0 with terrains. Only suggestion is for you to increase the altitude of your landscape prior to creating your lake.
-
Why do you have the App:Start() and App:Loop() functions inside your Script:PostRender() function? The App functions and App.lua script are deprecated but can still be used as your main script. I personally prefer just using the Main.lua script as it is more straight forward to use. The Script:PostRender() is to be used in an entity script not the main program script.
-
Well, 58 of the 77 packs - but yeah this is great. Saved to external harddrive for later perusing. Thanks, shad!
-
sounds promising...
-
You are evaluating a force vector against a Vec3 position based on the distance between their respective Vec3 values? Seems like there would be a lot of things that could affect the outcome on whether or not this worked correctly. Since the model is a physics object, it can be affected by other physics forces in the scene which could make the distance check fail. What are you setting the mass of the model to since that will affect how far your force (targetDirection) will move it? Also, the inverse of targetDirection is Vec3(-1,-4,0) which when used as a force will try to force the model down and to the negative X axis. Since it is a physics object, I assume the model is sitting on the ground so a negative Y force will not work. If you are really wanting to use a physics object then i would try a more generic approach for alternating the force values without looking at positions. example: window = Window:Create() context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:SetPosition(0,2,-4) camera:SetRotation(0,0,0) light = DirectionalLight:Create() light:SetRotation(35,35,0) ground = Model:Box(10,1,10) ground:SetColor(0,1,0) shape = Shape:Box(0,0,0, 0,0,0, 10,1,10) ground:SetShape(shape) ground:SetCollisionType(Collision.Scene) ground:SetPosition(0,-0.5,0) shape:Release() model = Model:Box() model:SetColor(1,0,0) model:SetPosition(0,0.5,0) shape = Shape:Box(0,0,0, 0,0,0, 1,1,1) model:SetShape(shape) model:SetCollisionType(Collision.Prop) shape:Release() model:SetMass(1) Force = Vec3(100,400,0) back = true time = Time:Millisecs() while window:KeyDown(Key.Escape)==false do if window:Closed() then break end if Time:Millisecs() > time + 1000 then if back == true then model:AddForce(Force, true) back = false else model:AddForce(Vec3(Force.x*-1,Force.y,Force.z), true) back = true end time = Time:Millisecs() end Time:Update() world:Update() world:Render() context:Sync(true) end If you are just trying to accomplish a bouncing back and forth object, maybe an animated object would suit your needs better?
-
Are there other ways of achieving this? (aka "Collisions, updates, and you!")
macklebee replied to sjg's topic in Programming
Maybe just try a simple raycast via World:Pick()or Entity:Pick()? Granted the API Reference recommends a World:Pick() over an Entity:Pick() because it would be faster, but both give the ability for you to control the length of the raycast which you can indirectly use as a way control how close you have to be to trigger a conversation. -
Based on this post by Phoenix88: http://www.leadwerks.com/werkspace/topic/15629-entitys-childs-start-function-does-not-get-called/#entry104340 and the previous closed bug report from Rick: http://www.leadwerks.com/werkspace/topic/11252-prefab-children-not-getting-scriptstart-called/page__hl__prefab+children Prefabs that have child entity scripts are not calling their Start() functions when loaded via code. The scripts appear to be loaded since the Start() function can be called: prefab = Prefab:Load("Prefabs/Pivot_crawler.pfb") child = prefab:FindChild("Crawler") child.script:Start() Loading a prefab from Map:Load() works but not from Prefab:Load(). It's almost like the 'Prefab.NoStartCall' flag is hardcoded on the child entities. Attaching example application that has a map that loads a prefab consisting of a pivot and a scripted crawler as its child and the exact same prefab next to it loaded via code. PrefabChildTest.zip
-
Loading prefab with flag causes crash in published game
macklebee replied to Genebris's topic in Programming
I am confused on this. Should not the flag parameter have the two flags added together instead of separated by a comma? If not, then this is different than all other usage of LE commands that have the ability to stack multiple options together for 1 parameter (eg. the style parameter for Window:Create()). Seems like the reason it is failing to load would be because the engine thinks you are setting the fileid parameter for a workshop item with the variable 'Prefab.NoStartCall'. Syntax static Entity* Load(const std::string& path, int flags=Map::LoadScripts, const uint64_t fileid=0) So it should be: Prefab:Load("prefabs/projectiles/arrow.pfb", Map.LoadScripts+Prefab.NoStartCall) Edit--But yes, I agree that it needs to give an error regarding this when played from the editor if it cannot find that workshop GUID item. -
You Won't Believe what Analytics in Leadwerks Reveal
macklebee commented on Josh's blog entry in Development Blog
Also, if possible, take a look at the issue with a prefab's child entities with a script not performing the Start() function when the prefab is loaded via code. Its almost as though the 'NoStartCall' flag is hardcoded when using Prefab:Load(). -
Entity's childs "Start" function does not get called!
macklebee replied to Phodex Games's topic in Programming
Yes, this should be addressed. Its odd that a prefab loaded via map loading will work but loading a prefab via code will not. Seems like the Prefab::NoStartCall is hard coded no matter what value the Prefab:Load() flag is set at. You can find a specific child in the prefab, and call its Start() function. prefab = Prefab:Load("Prefabs/childstartest.pfb") child = prefab:FindChild("crawler_attachment") child.script:Start() Not very useful or reasonable to have to do, but is another approach to call the Start() on prefab children. Or having to set a one time call to the Start() function in the UpdateWorld() of that child's script... either way, pretty silly to have to do.- 5 replies
-
- Start Function
- Functions
-
(and 1 more)
Tagged with:
-
Actually I had this problem today as well. No camera turning with mouse movement and right button held down and no movement via the WASD keys. Only movement in the perspective viewport was from the mouse scroll. Also, I noticed that the script editor stopped showing what assets were being loaded when running the game via the editor. I rebooted my computer and all works now.
-
Two things off the bat that I see is that you didn't load the custom shader and then you did not set the context's shader to it. self.imageshader = Shader:Load("Shaders/Drawing/drawimage.shader") should be: self.imageshader = Shader:Load("Shaders/Drawing/drawimage_enhanced.shader") and context:SetShader(imageshader) should be: context:SetShader(self.imageshader) Also, the correct syntax for the PostRender is: function Script:PostRender(context) Also I would recommend capturing the current context shader prior to setting to the custom and then setting it back prior to ending the PostRender: Script.Tx = Texture:Load("Materials/Compass/compass.tex") function Script:Start() self.camera = Camera:Create() self.camera:SetRotation(self.entity:GetRotation(true)) self.camera:SetPosition(self.entity:GetPosition(true)+Vec3(0,1.8,0)) self.imageshader = Shader:Load("Shaders/Drawing/drawimage_enhanced.shader") end function Script:PostRender(context) local oldshader = context:GetShader() context:SetShader(self.imageshader) self.imageshader:SetVec2("pivotposition", Vec2(100.0,100.0)) self.imageshader:SetFloat("angle",45) context:DrawImage(self.Tx,100,100,200,200) context:SetShader(oldshader) context:DrawLine(100,100,200,200) end EDIT: I see you edited your post. I do not recommend that you overwrite an existing standard shader that comes with the engine as there are possiblities of it getting overwritten from engine updates. If you use the code i posted, it will work without the need to overwrite existing shaders.
-
One way to do it: http://www.leadwerks.com/werkspace/topic/13422-draw-image-mirror-options/#entry94355
-
If you are using a trigger based on collision, the effect is being added more than once to the camera post effect stack. You need to add a boolean check to prevent the effect from being added more than once. example: Script.rain = false ... ... ... function Script:Change() if self.rain==false then self.rain = true self.camera:AddPostEffect("Shaders/PostEffects/Rain.shader") end end Edit - Same problem here: http://www.leadwerks.com/werkspace/topic/15421-clearposteffects-making-graphics-go-crazy/#entry103394
-
Don't know. Your code worked fine for me. Setting the friction to 0 just made the box slide for a little after the user input was no more. I can set the velocity.z down to 1 and it still moves. Also, using the AddForce.z at 10 works as well when the friction is set to 0. If the friction is set to 1 then just increase the value to overcome the box's mass and gravity. Speaking of which, if the numbers above are not working for you what is your scene's gravity set to? The default is 25.