Jump to content

macklebee

Members
  • Posts

    3,946
  • Joined

  • Last visited

Everything posted by macklebee

  1. You would need to post the script you are using for the modded autopistol and any relevant files/scripts/etc to be able to troubleshoot the problem. And as a side note, the Bug Reports forum is meant for engine bugs and not bugs with your custom code. This post would be better placed in the programming forum. Also, if I had to guess, the raycast pick is not hitting the crawler... again without the relevant files to troubleshoot, it is just a guess.
  2. Ah - ok... you are loading it dynamically - that information you left out in the OP. Then in that case you have to cast the emitter to the Emitter class. It's probably best to get in the habit (myself included) to cast special entities after using GetChild or FindChild. This example works now even when the chamfer box is loaded dynamically via code: function Script:UpdateWorld() local window = Window:GetCurrent() if window:KeyHit(Key.Up) then local emitter = self.entity:GetChild(0) tolua.cast(emitter, "Emitter") emitter:Reset() emitter:SetColor(math.random(0,255)/255,math.random(0,255)/255,math.random(0,255)/255,1) end end
  3. Lets not confuse terms here - a "prefab" in LE is one or more models/brushes combined with a possible script attached and typically set with specific physics properties. What you are importing to LE is just a model that has several surface materials. Without seeing the model itself, we can only guess, but I would suspect that the walls do not have the UVs appropriately mapped which will cause a smeared color to appear instead of a texture mapped across the surface. Or the materials have not been properly created. If you want more help you will have to post the model/materials in question.
  4. Works fine for me. Are you sure that the emitter is the only child? I suggest performing an entity:CountChildren() to confirm. example code: function Script:UpdateWorld() local window = Window:GetCurrent() if window:KeyHit(Key.Up) then local emitter = self.entity:GetChild(0) emitter:Reset() emitter:SetColor(math.random(0,255)/255,math.random(0,255)/255,math.random(0,255)/255,1) end end Also, remember there are several ways to access the emitter. You could use entity:FindChild() to search for the emitter's specific name. Or make it a script entity property in the property panel and drag the emitter to the textbox.
  5. http://www.leadwerks.com/werkspace/topic/12294-how-does-one-renames-a-project-in-leadwerks/#entry89268
  6. Well I see a couple of issues with the script. The drifting in a lua controller is typically caused by rounding errors when setting the mouse position, so you need to round the 'GetWidth/GetHeight'. The code for setting the position of the camera is using the entity's global coordinates but applied as the camera's local coordinates from the entity. This will offset the camera depending on where the entity is placed within the scene. Global coordinates are based on location in the scene, Local coordinates are based on location from the parent. If no parent, then local and global coordinates are the same. I suggest that you also set up the initial camera rotation to match that of the controller. I have no idea what this line is trying to accomplish, so cannot comment: mousex = (-5*(window:GetWidth()/2 - mousex))/window:GetWidth() Assuming you wanted a fps camera not sitting on the ground, you also need to offset the Y position of the camera from the entity position. Also you state that you are just using a cube for a character at the moment, so remember to set the physics mode to character controller and to give it mass greater than zero or the SetInput command will not work. example code: function Script:Start() self.camera = Camera:Create(self.entity) local entpos = self.entity:GetPosition(true) self.camera:SetPosition(entpos.x,entpos.y+1,entpos.z,true) --set camera 1m off of ground self.camrotation = self.entity:GetRotation(true) --sets default cam rotation variable self.camera:SetRotation(self.camrotation,true) local window = Window:GetCurrent() self.gx = Math:Round(window:GetWidth()/2) --must round or camera will drift self.gy = Math:Round(window:GetHeight()/2) --must round or camera will drift self.move = 0 self.strafe = 0 end function Script:UpdateWorld() local window = Window:GetCurrent() local mouseposition = window:GetMousePosition() window:SetMousePosition(self.gx, self.gy) local dx = mouseposition.x - self.gx local dy = mouseposition.y - self.gy self.camrotation.x = self.camrotation.x + dy / 10--look up an down self.camrotation.y = self.camrotation.y + dx / 10--look left and right self.camera:SetRotation(0,self.camrotation.y,0,true) end function Script:UpdatePhysics() local window = Window:GetCurrent() self.move = Math:Curve(((window:KeyDown(Key.W)and 1 or 0) - (window:KeyDown(Key.S) and 1 or 0)),self.move,10) self.strafe = Math:Curve(((window:KeyDown(Key.D)and 1 or 0) - (window:KeyDown(Key.A) and 1 or 0)),self.strafe,10) self.entity:SetInput(self.camrotation.y, self.move, self.strafe) end Since your above code only has the camera being able to rotate side to side and not up and down, I made the example code to match above. There are other code tidbits that you can add to make the camera movement smoother, consistent based on FPS, etc... which can be found in the inherent LE 'fpsplayer' script. I suggest you review that script for more insight.
  7. I assume you are asking for the LE2 wiki and tuts since your first two questions concern LE2.5? If so, the LE2 wiki/documentation/tutorials are here: http://www.leadwerks.com/wiki/index.php?title=Main_Page
  8. My suggestion would be to look at the tutorial map 'Events and AI' map that also comes with a video tutorial.
  9. If you are using the navmesh, then you will want to use Entity:GoToPoint() and Entity:SetInput() for navigation. Look at the inherent MonsterAI.lua script for a working solution.
  10. Well thats something completely different. You are asking to rotate the player to not face the picked position but to also move the player. You can use the picked position and the normal to determine location. newPos = pickinfo.position + Vec3(1,1,1) * pickinfo.normal --where vec3(1,1,1) is the max distance from the picked pos and you should be able to perform the '+ 180' to the player rotation after the player is positioned while rotating to face the point. Keep in mind you will probably have to perform some checks to make sure that 'normal.y' doesn't put the player in a weird location in case the pick can ever be ontop or below a "box".
  11. Not quite sure what you are asking for here... are you referring to World:SetLightQuality() or Camera:SetMultisampleMode()? Or are you just referring to the reflections on the cube in that screenshot? If so, that is just a reflection shader and has nothing to do with the quality of the graphics.
  12. Yes, it is supposed the determine the angle between the picked position and the player. You need a reference to the player position to determine how much the player needs to turn to face the picked position. You could use wall normals to determine how to orient the player but it will not necessarily end up with the player facing the wall itself. Here is an example of how to use the camera and picked positions to determine the angle to rotate the camera to face the picked position: function App:Start() self.window=Window:Create("Test",0,0,800,600,window.Titlebar+window.Center) self.context=Context:Create(self.window,0) self.world=World:Create() self.light = DirectionalLight:Create() self.light:SetRotation(35,35,0) self.camera = Camera:Create() self.box = Model:Box() self.box:SetColor(1,.5,0,1) self.box:SetPosition(1,1,3) self.box1 = Model:Sphere() self.box1:SetColor(1,0,0,1) self.box1:SetPosition(-1,0,3) function PerfectAngle(pos1,pos2) local dx, dz dx = pos1.x - pos2.x dz = pos1.z - pos2.z return Math:ATan2(dx,dz) end pickinfo = PickInfo() pick = nil angle = self.camera:GetRotation().y return true end function App:Loop() if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end if (self.window:MouseHit(1)) then local mousePos = self.window:GetMousePosition() pick = self.camera:Pick(mousePos.x, mousePos.y, pickinfo, 0, true) end if pick then perfectangle = PerfectAngle(pickinfo.position,self.camera.position) angle=Math:IncAngle(perfectangle,angle,5/Time:GetSpeed()) self.camera:SetRotation(0,angle,0) end Time:Update() self.world:Update() self.world:Render() self.context:Sync(true) return true end
  13. A normal is between -1 and 1 and is used to show direction/orientation. If the picked object is a vertical face (like a wall), then 'normal.y' will always be 0. If the picked face is parallel to the x-axis, then it will also return 0. So performing a Math:Atan2 on (0,0) will always return 0. So the return here is just the orientation without regards to the player's current position. So the best it can do is orient the player but doesn't mean the player will be facing the object picked. The code listed here (similar to the same post that you have already posted here) that uses the position of the pick will return what you need.
  14. Well I can get it to load occasionally without crashing the editor but it takes about 30 seconds to appear and you can't click on anything after dragging it into the scene prior to it finishing loading without it locking the program up. It contains 42 boxes but that still doesn't seem to explain the 37MB's. As a test, I made 42 boxes and then also created another 100+ separate boxes by selecting the original 42 and carving them into one big box... and the saved prefab from this is only 1MB. Some else posted a bug about the map size doubling each time they copied a csg box which i cannot reproduce either... EDIT--it is interesting to note that when I exported your model it was only 17kb as obj and re-imported as mdl it was only 22kb.
  15. Post the contents of the material file as it needs to have the animation shader applied. Adding animations via the LE model editor requires an animation that has the same skeleton hierarchy as the base model and using the 'File-->Load Animation..' feature. Posting the fbx model and its texture would be beneficial as well.
  16. The Indie Edition is lua only but you can purchase the DLC for the Standard Edition that allows programming in lua and c++. You have to own the Indie Edition to be able to use the Standard Edition DLC, So purchase the Indie Edition for $99 then purchase the Standard Edition DLC for $99 to be able to program in c++.
  17. The default in LE is to convert the image to DXT1 which will scale the image to the closest power of 2 size. All of the DXT-compression options (and adding mipmaps) will do this. Just change the image compression back to 'Uncompressed', uncheck 'generate mipmaps', and then save the file, and the *.tex image will go back to the original size.
  18. Ok so the face's z-position is zero which is what the 'pos.z' is returning. Are you confused by the '#.#########e-007' numbers? That is just rounding discrepanacies, but essentially the 'e-007' (scientific notation) is telling you that the decimal is actually 7 places to the left which would make the value '0.000000######'.
  19. I am confused by your description. If the cube face that you are picking is aligned with the x-axis, then z = 0 (which relates to the values you are showing). It might help if you gave the position and size of the csg cube itself so we understand exactly where it is in global space. Also, as a sanity check, place a non-pickable item at the position of the pick to visually see if the position is correct. if (window:MouseHit(1)) then local pickinfo = PickInfo() if (self.camera:Pick(context:GetWidth() / 2, context:GetHeight() / 2, pickinfo, 0, true)) then System:Print(pickinfo.position.z) local sphere = Model:Sphere() sphere:SetPickMode(0) sphere:SetScale(.2,.2,.2) sphere:SetColor(1,0,0,1) sphere:SetPosition(pickinfo.position) end end
  20. You can set the collisiontype for any of the raycast commands, so you would setup a response between the player raycast's and the cover's collisiontypes. For the mob's raycast, you have to set the collisiontype to something other than 0 as this will detect everything.
  21. Agree that Collision:SetResponse() needs to be added to the documentation... but you have asked and been given this answer before...http://www.leadwerks.com/werkspace/topic/10362-physics-collision-overlap/page__hl__overlap
  22. Light blend does not use alpha for transparency (see shadmar's link above) as the texture would be non-alpha with a black background. But you could set the endcolor to black and this will help fade the particles.
  23. I suspect you would have to do it through windows explorer with the editor closed. Rename the project folder, the *.werk file, and the release/debug executables. Then after opening the editor, go to the Project Manager and import the new project via the newly named *.werk file. Or just create a new project via the Project Manager and copy/move the required assets/maps over into the newly created Project.
×
×
  • Create New...