Jump to content

macklebee

Members
  • Posts

    3,946
  • Joined

  • Last visited

Everything posted by macklebee

  1. well its hard to comment on your implementation in your own editor... I just know it works for the example I gave. If I swap the X & Z in my example, it doesn't work correctly. Perhaps Josh is rotating the terrain to make the terrain's X&Z planes line up with world's planes?
  2. It works fine for me in my example using TerrainElevation. Instead of: try this: PositionEntity(model, Vec3(p.x, TerrainElevation(terrain, p.x, p.z), p.z)) or PositionEntity(model, Vec3(p.x, TerrainElevation(p.entity, p.x, p.z), p.z)) just depending on how you are filtering out just terrain picks... but either way it looks like you have your p.x & p.z swapped.
  3. yes, they are extremely small values - which is why I do not see any floating models...
  4. I assume those of us that had one time downloaded the pack from here can still use them for commercial games?
  5. using the pick's X&Z for TerrainElevation appears to work just fine require("Scripts/constants/collision_const") require("Scripts/constants/engine_const") require("Scripts/math/math") RegisterAbstractPath("") Graphics(800,600) fw=CreateFramework() scene=LoadScene("Maps/train.sbx") controller=CreateController(1.8,0.45,0.25,45,0.9) controller:SetCollisionType(COLLISION_CHARACTER,0) controller:SetMass(100) controller:SetPosition(Vec3(18,1,0)) camerapitch=fw.main.camera.rotation.x camerayaw=fw.main.camera.rotation.y local camera = fw.main.camera HideMouse() MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) while KeyHit(KEY_ESCAPE)==0 do jump=KeyHit(KEY_SPACE)*6.0 if controller:IsAirborne()==1 then jump=0 end gx=Round(GraphicsWidth()/2) gy=Round(GraphicsHeight()/2) dx=Curve((MouseX()-gx)/4.0,dx,3.0/AppSpeed()) dy=Curve((MouseY()-gy)/4.0,dy,3.0/AppSpeed()) MoveMouse(gx,gy) camerapitch=camerapitch+dy camerayaw=camerayaw-dx camerapitch=math.min(camerapitch,90) camerapitch=math.max(camerapitch,-89.99) fw.main.camera:SetRotationf(camerapitch,camerayaw,0,1) movespeed=4 movesmoothing=10 if controller:IsAirborne()==1 then movesmoothing=200 end move=Curve( (KeyDown(KEY_W)-KeyDown(KEY_S))*movespeed,move,movesmoothing) strafe=Curve( (KeyDown(KEY_D)-KeyDown(KEY_A))*movespeed,strafe,movesmoothing) if MouseHit(1)==1 then pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,1000.0),0,0) if pick~=nil then if pick.entity:GetClass()==ENTITY_TERRAIN then terrainheight=TerrainElevation(pick.entity, pick.position.x, pick.position.z) local oildrum = LoadModel("abstract::oildrum.gmf") oildrum:SetPosition(Vec3(pick.position.x, terrainheight, pick.position.z)) end end end-- controller:Update(camerayaw,move,strafe,jump,400,1) fw:Update() fw.main.camera:SetPositionf(controller.position.x,controller.position.y+1.8,controller.position.z,1) fw:Render() SetBlend(1) DrawText("Left-click mousebutton to pick terrain and set model",0,20) DrawText("><", GraphicsWidth()/2-8,GraphicsHeight()/2-8) if pick~=nil then DrawText("Pick Position X: "..pick.position.x,0,60) DrawText("Pick Position Y: "..terrainheight,0,80) DrawText("Pick Position Z: "..pick.position.z,0,100) end SetBlend(0) Flip(0) end controller:Free() ShowMouse()
  6. hmmm... i am not getting the results you are getting with objects floating in the air, but i am just doing a quick test in a standalone lua script... require("Scripts/constants/collision_const") require("Scripts/constants/engine_const") require("Scripts/math/math") RegisterAbstractPath("") Graphics(800,600) fw=CreateFramework() scene=LoadScene("Maps/train.sbx") controller=CreateController(1.8,0.45,0.25,45,0.9) controller:SetCollisionType(COLLISION_CHARACTER,0) controller:SetMass(100) controller:SetPosition(Vec3(18,1,0)) camerapitch=fw.main.camera.rotation.x camerayaw=fw.main.camera.rotation.y local camera = fw.main.camera HideMouse() MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) while KeyHit(KEY_ESCAPE)==0 do jump=KeyHit(KEY_SPACE)*6.0 if controller:IsAirborne()==1 then jump=0 end gx=Round(GraphicsWidth()/2) gy=Round(GraphicsHeight()/2) dx=Curve((MouseX()-gx)/4.0,dx,3.0/AppSpeed()) dy=Curve((MouseY()-gy)/4.0,dy,3.0/AppSpeed()) MoveMouse(gx,gy) camerapitch=camerapitch+dy camerayaw=camerayaw-dx camerapitch=math.min(camerapitch,90) camerapitch=math.max(camerapitch,-89.99) fw.main.camera:SetRotationf(camerapitch,camerayaw,0,1) movespeed=4 movesmoothing=10 if controller:IsAirborne()==1 then movesmoothing=200 end move=Curve( (KeyDown(KEY_W)-KeyDown(KEY_S))*movespeed,move,movesmoothing) strafe=Curve( (KeyDown(KEY_D)-KeyDown(KEY_A))*movespeed,strafe,movesmoothing) if MouseHit(1)==1 then pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,1000.0),0,0) if pick~=nil then if pick.entity:GetClass()==ENTITY_TERRAIN then local oildrum = LoadModel("abstract::oildrum.gmf") oildrum:SetPosition(Vec3(pick.position.x, pick.position.y, pick.position.z)) end end end-- controller:Update(camerayaw,move,strafe,jump,400,1) fw:Update() fw.main.camera:SetPositionf(controller.position.x,controller.position.y+1.8,controller.position.z,1) fw:Render() if pick~=nil then SetBlend(1) DrawText("Pick Position X: "..pick.position.x,0,60) DrawText("Pick Position Y: "..pick.position.y,0,80) DrawText("Pick Position Z: "..pick.position.z,0,100) SetBlend(0) end SetBlend(1) DrawText("><", GraphicsWidth()/2-8,GraphicsHeight()/2-8) SetBlend(0) Flip(0) end controller:Free() ShowMouse() I am however seeing the strange values occurring for the Y value when done on flat terrain at 0 altitude, though seems to work just fine on higher elevation. Perhaps you can use the X & Z values from the pick for the command TerrainElevation to get a more precise Y value. Granted I have tried my method above with CreateCube and a physics model and even with strange Y values, it appears to place the model correctly.
  7. Yes, I know where it was or where it should be, because I had at one time downloaded it. I am saying its no longer there that I can see. I assume it was removed so it could be sold on betke's website.
  8. glad you got something to work for you... as a request, can you start using the code snippet format "<>" that is on the reply toolbar? It makes it easier for everyone to read along.
  9. That id number is built inside the LE editor- its purpose I am not quite sure, for I have yet to actually have any need for it. And I offhand it doesn't appear to create this id number for the terrain, so I am not sure how you would go about creating it specifically for terrains nor do I understand why you think you need it.
  10. where is this tree pak? doesn't look like its there any more unless i am blind? in any case, what it used to have was a readme text file that said they could be used for any LE game.
  11. look at the environment_atmosphere properties... it has a camerarange setting
  12. I personally never have seen a waterplane script posted here that has this feature, but this is how I would do it. require("scripts/class") local class=CreateClass(...) function class:InitDialog(grid) self.super:InitDialog(grid) local group=grid:AddGroup("Water") group:AddProperty("submersioncolor",PROPERTY_COLOR,"","Submersion Color") group:AddProperty("Softness",PROPERTY_FLOAT,"0,50") group:AddProperty("Visibility",PROPERTY_VEC2) group:AddProperty("Amplitude",PROPERTY_FLOAT,"0,16") group:AddProperty("WaveSpeed",PROPERTY_FLOAT,"0,10","Wave speed") group:AddProperty("ShowWater", PROPERTY_BOOL) group:Expand(1) end function class:CreateObject(model) local object=self.super:CreateObject(model) object.height=model.mat.ty object.submersioncolor=Vec4(0.5,0.5,0.5,1.0) object.softness=1 object.visibility=Vec2(0,20) object.amplitude=1 object.wavespeed=1 object.model:SetKey("submersioncolor","128,128,128,255") object.model:SetKey("softness","1.0") object.model:SetKey("visibility","0,20") object.model:SetKey("amplitude","1.0") object.model:SetKey("wavespeed","1.0") object.model:SetKey("ShowWater","1") function object:Refresh() if fw~=nil then fw.renderer:SetWater(self.showwater) fw.renderer:SetWaterHeight(self.height) fw.renderer:SetWaterColor(self.model.color,self.submersioncolor) fw.renderer:SetWaterSoftness(self.softness) fw.renderer:SetWaterVisibility(self.visibility.x,self.visibility.y) fw.renderer:SetWaterAmplitude(self.amplitude) fw.renderer:SetWaterWaveSpeed(self.wavespeed) end end function object:UpdateMatrix() self.height=self.model.mat.ty self:Refresh() end function object:UnlockKeys(model) object:Refresh() end function object:SetKey(key,value) if key=="softness" then self.softness=tonumber(value) elseif key=="submersioncolor" then self.submersioncolor=StringToColor(value) elseif key=="visibility" then self.visibility=StringToVec2(value) elseif key=="wavespeed" then self.wavespeed=tonumber(value) elseif key=="showwater" then self.showwater=tonumber(value) elseif key=="amplitude" then self.amplitude=tonumber(value) elseif key=="position" then local t t=StringToVec3(value) self.height=t.y return self.super:SetKey(key,value) else return self.super:SetKey(key,value) end return 1 end function object:Free() local model,object self.class:RestoreDefaults() for model,object in pairs(self.class.instances) do if object~=self then object:Refresh() break end end self.super:Free() end object:Refresh() end function class:RestoreDefaults() if fw~=nil then fw.renderer:SetWater(0) fw.renderer:SetWaterHeight(0.0) fw.renderer:SetWaterColor(Vec4(1,1,1,1),Vec4(0.5,0.5,0.5,1.0)) fw.renderer:SetWaterSoftness(1.0) fw.renderer:SetWaterVisibility(0,50) fw.renderer:SetWaterAmplitude(1.0) fw.renderer:SetWaterWaveSpeed(1.0) end if fw.renderer.waterpatch~=nil then fw.renderer.waterpatch:SetParent(nil,1) end end function class:Free() self:RestoreDefaults() self.super:Free() end
  13. The firepit model specifically uses the fw.transparency.world inside its lua script. Without seeing your code, one can only guess at how you are handling that. If you are wanting to actually see the framework code, then you need to download an older version of LE (like 2.30) and look at the BMAX framewerk code.
  14. All sounds great NA! 1) Pathfinding 2) NPC Behavior 3) GUI Library perhaps? Seems like at this point LE would already have this stuff inherently built into it, but for some reason the current focus for LE is too make scenery for screenshots and phone apps. Would have thought you have gotten some feedback\support from Josh on this by now?
  15. try it without modifying the move and strafe variables... look at the wiki tut for Character Controllers and you will see that the code doesn't use any multiplier on the move or strafe
  16. try using the Curve function to get rid of the jerkiness: mx=Curve(MouseX()-GraphicsWidth()/2,mx,6); my=Curve(MouseY()-GraphicsHeight()/2,my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/10.0; camrotation.Y=camrotation.Y-mx/10.0; RotateEntity(fw.GetMain().GetCamera(),camrotation,1);
  17. understand completely... RL comes first. also, you need to setup your profile to allow for PM's to be sent to you! I cant send you a PM because it looks like your account doesnt have it enabled.
  18. no problem... first time ive got to touch LE in over a month... so I understand about refresher learning...
  19. i thought we already covered this here 1) the object scripts for lights were modified at one point so maybe that was part of the issue 2) what is your app path for your media in the bmax program?
  20. increase the maxacceleration value to something like 300-500
  21. instead of looping and checking for the model class, just check that the specific model's name is the one you want... try using the GetMeshModel() from the utilities.lua going from memory here since i currently do not have access to LE...
  22. I think lumooja might be giving you the impression that you might be able to do this right out of the box with leadwerks with something thats already built in to the engine. What you are asking to do is possible, but not without you programming it. Leadwerks does not have any inherent game mechanics or AI pathfinding or GUI... all of these things you will need to do yourself or perhaps teamup with someone else and have them program for you. Out of the box, you can make a nice scene that you can fly around inside the editor without programming, but that does not make a game... even though that seems to be where all the focus seems to be lately.
×
×
  • Create New...