Jump to content

Meldrion

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by Meldrion

  1. I had the same problem but your solution with the Garbage Collector helped me out too. Thank you very much
  2. Good evening. I try to make simple collision Events ( when u hit the Invisible Trigger, a Sound starts to play etc) with Delphi 7. Well the problem I have, is that when I hit my Trigger I get an AccessViolation. I know that this was reported as a Bug and Josh fixed it but still, it is not working for me. EntityType(MyController,1,1); EntityType(CollisionBox,4,1); Collisions(1,4,2); SetEntityCallback(CollisionBox,@EntityCollisionCallback,ENTITYCALLBACK_COLLISION); in my MainLoop i call this for testing: MessageBox(CollisionInfo); Here are some functions I made in order to make things easier for me: procedure MessageBox(Text:string); var Texture: TTexture; begin SetBlend( BLEND_ALPHA ); Texture := LoadTexture('abstract::textbox.dds'); DrawImage (Texture,10,10,600,120); SetColor ( Vec4(255,255,255,255) ); DrawText(30,30,pChar(Text)); end; procedure EntityCollisionCallback(entity0:TEntity;entity1:TEntity;position:Pointer;normal:Pointer;force:Pointer;speed:real );stdcall; var VecPosition: TVec3; begin CollisionInfo:= GetEntityKey(entity0,'Name'); end; Btw: The @T means the AdressOf(T) in Delphi I hope someone can help me out, cause this is about to drive me crazy.
  3. But how can I set this ? I dont know how to access the terrain that is my scene. Here is the code I have made so far --require("scripts/hooks") require("scripts/constants/keycodes") --Register abstract path RegisterAbstractPath("") --Set graphics mode if Graphics(1024,768,0,60,0)==0 then Notify("Failed to set graphics mode.",1) return end -- Custom shutDown Variable ShutDown= false --Create framewerk object and set it to a global object so other scripts can access it fw=CreateFramework() if fw==nil then Notify("Failed to initialize engine.",1) return end SetGlobalObject("framewerk",fw) -- Setup Initial Post Processing FX SetGodRays(1) SetHDR(0) SetSSAO(0) SetBloom(1) SetAntialias(0) SetNearDOF(0) SetFarDOF(1) SetFarDOFRange(22, 150); SetZoom(2) scene=LoadScene("abstract::TestSideScroll.sbx") camera=fw.main.camera camera:SetPositionf(0,1.5,-1.5) -- Create the Player player2D = CreatePlane(); --player2D:SetPosition(Vec3(0,1.5,2.5)) player2D:SetScale(Vec3(0.5,1,0.7)) player2D:SetRotation(Vec3(270,0,0)) -- Create the Collider for the Player player2DBody = CreateBodyBox(1,1.5,1) player2DBody:SetPosition(Vec3(0,1.5,2.5)) -- TestCollider --playground = CreateBodyBox(5,2,5) --playground:SetPosition(Vec3(0,0,1)) EntityParent(player2D,player2DBody) SetBodyMass(player2DBody,0.1) -- Only for testing DebugPhysics(1) -- Enable the Rain Sound Effect class = classnametable[ "innowork_soundcontroller" ] if class~=nil then for model,object in pairs(class.instances) do object.model:SetKey("enabled","1") object.model:SetKey("soundfile","Regen.ogg") end end -- Get the RainParticles myRain = classnametable["environment_emitter"] if myRain ~=nil then for model,object in pairs(myRain.instances) do myRainModel = object.model end myRainModel:SetPosition(Vec3(0,6.5,3), 1 ) end -- Control the Camera (and all object bound to it) function ControlCamera() if KeyDown (KEY_D)==1 then MoveEntity (camera, Vec3(0.1*AppSpeed(),0,0)) -- Move the Rain Particle Effect so that the Rain is allways in the -- ScreenView if myRainModel ~=nil then MoveEntity(myRainModel,Vec3(0.1*AppSpeed(),0,0)) end -- Move the PlayerSprite if player2D ~=nil then MoveEntity(player2DBody,Vec3(0.2*AppSpeed(),0,0)) end end if KeyDown (KEY_A)==1 then MoveEntity (camera, Vec3(-0.1*AppSpeed(),0,0)) -- Move the Rain Particle Effect so that the Rain is allways in the -- ScreenView if myRainModel ~=nil then MoveEntity (myRainModel, Vec3(-0.1*AppSpeed(),0,0)) end -- Move the PlayerSprite if player2D ~=nil then MoveEntity(player2DBody,Vec3(-0.2*AppSpeed(),0,0)) end end if KeyDown(KEY_ESCAPE)==1 then ShutDown=true end end -- Collisions Collisions(1,1,1); EntityType(player2DBody,1) --EntityType(playground,1) --EntityType(terrain,1) -- while AppTerminate()==0 and ShutDown == false do UpdateAppTime() fw:Update() fw:Render() ControlCamera() Flip(0) end Meldrion
  4. Hello, i started working with colliders today and I have a question about it. How can I create a Terrain Collider ? Because in my code the BoxCollider still goes through the terrain. Meldrion
  5. Ok thanks for the help. I found out that the problem is the Particle Vertex Shader ( the particles.vert File ) After rewriting the file to my needs i saved it to particles_rain.vert and i told my rain.mat file to use this new shader. Now its working wonderfully B) Meldrion
  6. Hey there. I want to make a simple rain effect with Particles. For that i made myself a very simple Material for the Rain Particles. Now I attach this Material with the Particle Emitter Script. First that I tested the effect it worked how it should. But after reloading the Script it changed the start angle of my particles so my rain looks like stuff ^^ For making stuff more clear, I made 2 Screenshots of my Problem: How it should work After reloading the Script: Those are my Emitter Settings Hope someone can tell me what I am doing wrong. Meldrion
  7. Ok thank you very much for your help B) I finally made it to load my Scene. The problem was that the Standart Trees ( vegetation_tree_spruce_2.gmf ) is a proteced file. I didnt know that ^^ Anyway thanks again for your help and have a nice day. Meldrion
  8. Actually i do use the Script Editor.exe that is included with the Engine. The Leadworks Editor itself is not open. sorry for double posting ^^ Edit: When you say strange what do you mean? Are you saying it crashes? More than likely your camera is below the terrain for the arctic SBX file, so it will look strange. Strange means for me that it simply crashed without giving an Access Violation or some other sort of Error. Edit2: How to i enable or disable this ? I cant remember that i protected my own Test.sbx Scene
  9. Ok, I made more tests and i found something out >.< Actually I CAN load some Scenes with this code... But only some. The tunnels.spx example does work. The train.spx also... So does the deserthighway.sbx example. But the terrain_arctic.sbx does the same kind of strange stuff as my Test.sbx did ? Now I am really confused... o.O Meldrion
  10. Well my first version was like yours. But since i didnt worked for me i started to try out some stuff. I assume the code u posted worked for you ? Since i just copy pasted it into the edtior ( changed the Scene back to test.sbx ) and ran my script. But still, it does the same as it did before... I´m using Win7 x64 ( maybe thats the problem ? ) but so far i didnt have any sort of trouble with the OS and the Engine. Meldrion
  11. require("scripts/hooks") require("scripts/constants/keycodes") --Register abstract path RegisterAbstractPath("") --Set graphics mode if Graphics(1024,768,0,60,0)==0 then Notify("Failed to set graphics mode.",1) return end -- Custom shutDown Variable ShutDown= false --Create framewerk object and set it to a global object so other scripts can access it fw=CreateFramework() if fw==nil then Notify("Failed to initialize engine.",1) return end SetGlobalObject("framewerk",fw) scene=LoadScene("abstract::Test.sbx") --camera=fw.main.camera camera=Scene.camera camera:SetPositionf(0,0,-2) camera:SetRotationf(45,0,0) --light=CreateSpotLight(10) --light:SetRotationf(45,55,0) --light:SetPositionf(5,1,-5) --material=LoadMaterial("abstract::cobblestones.mat") --mesh=CreateCube() --mesh:Paint(material) --ground=CreateCube() --ground:SetScalef(10.0,5.0,10.0) --ground:SetPositionf(0.0,-2.0,0.0) --ground:Paint(material) --light=CreateDirectionalLight() --light:SetRotationf(45,45,45) function DrawOverlay() SetBlend(1) SetColor(Vec4(1,0,0,0.25)) DrawRect(100,100,GraphicsWidth()-200,GraphicsHeight()-200) SetColor(Vec4(1,1,1,1)) SetBlend(0) end function ControlCamera() if KeyDown (KEY_W)==1 then MoveEntity (camera, Vec3(0,0,0.1)) end if KeyDown (KEY_S)==1 then MoveEntity (camera, Vec3(0,0,-0.1)) end if KeyDown(KEY_ESCAPE)==1 then ShutDown=true end end --AddHook("Flip",DrawOverlay) while AppTerminate()==0 and ShutDown == false do --mesh:Turnf(AppSpeed()*0.5,AppSpeed()*0.5,AppSpeed()*0.5) --fw:Update() --fw:Render() Scene:Update() Scene:Render() ControlCamera() Flip(0) end EDIT: The Engine loads the Scene ( because the Console tells me that the Scene Files are getting loaded ) But after loading the last Scene Asset it just terminates. Kind of Strange.
  12. Hello everyone I am still very new to Leadwerk Engine ( just got it yesterday ) and i have some sort of trouble with LUA. Well mainly I am a Pascal/Delphi Programmer ( but the Pascal Header doesnt work with my Delphi 7 ( trouble with the inline command ) so i do learn LUA kind of fast. My Problem is now that i want to load a Scene with LUA. Actually I try to do it with scene=LoadScene("abstract::Test.sbx") . The LUA Editor doesnt give me an Error and i can start my Game. But then nothing happens. The Game just closes and that it. No Error, nothing. And YES there is a GameLoop in my Source Well, i hope someone can help me with this. Meldrion
×
×
  • Create New...