-
Posts
24,629 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Josh
-
You can safely pass uniforms that don't exist, so you can declare these in whatever shaders you need, and set them from your program without worry. Or are you saying you want these to be global values the user sets, that all shaders access?
-
New here and wondernig about C# specifics
Josh replied to TheRhinoDude's topic in General Discussion
FYI, I won't do anything thats windows-only in LE3. That's one of the design rules. -
Well, buying the current version now gets you the option to upgrade to LE3 for an overall cost less than the price of a new LE3 license: LE2 + upgrade < LE3 license
-
New here and wondernig about C# specifics
Josh replied to TheRhinoDude's topic in General Discussion
I am aiming to have the beta of LE3 for sale in 2011. -
The headlight parts on that car look pretty high-detail. That could be reduced a lot. I guess the physics are bouncing around a bit at first until they settle. Maybe set the mass of these things to zero until a collision occurs? That way they would just be static until something actually hits them.
-
Delete the mesh and leave the bones, and make sure the hierarchy is the same. I don't know the specifics of doing that for any particular modeling program, but that's what you want.
-
The le3 beta is scheduled for release sometime in 2011
-
Leadwerks Engine 2 allows terrains up to 67 square kilometers, with a resolution of 2 meters per tile, and for whatever reason we seem to attract people who want even bigger terrains with fewer restrictions, so yes, lifting these restrictions is a priority in Leadwerks Engine 3. I don't want to make promises based on technology I have not yet invented, but I can tell you that a lot of people want the same thing as you, and that's what my goal is in the design of Leadwerks Engine 3.
-
That's actually quite a good summary. I'm impressed.
-
New here and wondernig about C# specifics
Josh replied to TheRhinoDude's topic in General Discussion
It's hard to quantify the answer to that. It's a new engine and a new start, but a lot of the design is the same. One important difference is I am using a strict naming scheme instead of making commands that individually sound nice. So instead of PositionEntity() you have SetEntityPosition(). Here's the current header file for the procedural command set: //Bank DLLExport int GetBankSize(le3::Bank* bank); DLLExport int PeekBankByte(le3::Bank* bank, int position); DLLExport char* GetBankBuffer(le3::Bank* bank); //Graphics driver DLLExport le3::OpenGL1GraphicsDriver* CreateOpenGL1GraphicsDriver(); DLLExport le3::OpenGL3GraphicsDriver* CreateOpenGL3GraphicsDriver(); DLLExport void SetGraphicsDriver(le3::GraphicsDriver* graphicsdriver); DLLExport le3::GraphicsDriver* GetGraphicsDriver(); DLLExport int GetGraphicsDriverName(le3::GraphicsDriver* graphicsdriver, char* s, int length); DLLExport int GetGraphicsDriverVendor(le3::GraphicsDriver* graphicsdriver); DLLExport int GraphicsDriverSupported(le3::GraphicsDriver* graphicsdriver); DLLExport int BuffersSupported(); //Timing DLLExport float UPS(); DLLExport int Millisecs(); DLLExport void UpdateTime(); //Network DLLExport le3::Server* CreateServer(int port); DLLExport le3::Message* UpdateServer(le3::Server* server, int timeout); DLLExport void DisconnectServer(le3::Server* server, le3::Peer* client, int force); DLLExport int SendServer(le3::Server* server, le3::Peer* client, int messageid, char* data, int size, int channel, int flags); //File system DLLExport void SetDir(const char* path); //Light DLLExport le3::DirectionalLight* CreateDirectionalLight(le3::Entity* parent); //Font DLLExport le3::Font* LoadFont(const char* path,int size,int style,int family); DLLExport void DrawFontText(le3::Font* font, char* text,int x,int y, float kerning); DLLExport int GetFontTextWidth(le3::Font* font,char* text); DLLExport int GetFontHeight(le3::Font* font); DLLExport void FreeFont(le3::Font* font); //Drawing DLLExport void SetViewport(int x, int y, int width, int height); DLLExport void SetColor(float r, float g, float b, float a); DLLExport void SetClearColor(float r, float g, float b, float a); DLLExport void SetBlendMode(int blendmode); DLLExport void DrawLine(int x0, int y0, int x1, int y1); DLLExport void DrawRect(int x, int y, int width, int height, int style); DLLExport void DrawImage(le3::Texture* image, int x, int y, int width, int height); DLLExport void TileImage(le3::Texture* image); DLLExport void SetRotation(float rotation); DLLExport void SetTranslation(float x, float y); DLLExport void SetScale(float x, float y); //Window DLLExport le3::Window* CreateWindow(const char* title,int width,int height,int style); DLLExport le3::Window* CreateCustomWindow(HWND hwnd); DLLExport int GetWindowWidth(le3::Window* window); DLLExport int GetWindowHeight(le3::Window* window); DLLExport void SetWindowShape(le3::Window* window, int x, int y, int width, int height); DLLExport void FreeWindow(le3::Window* window); //Context DLLExport le3::Context* CreateContext(le3::Window* window,int multisamplemode); DLLExport void SwapContext(le3::Context* context, int sync); //AssetReference DLLExport le3::MediaReference* FindAssetReference(char* s); DLLExport int ReloadAssetReference(le3::MediaReference* assetreference, int flags); DLLExport void SetAssetReferenceName(le3::MediaReference* assetreference, char* name); //DLLExport int CountAssetReferences(); //DLLExport le3::MediaReference* GetAssetReference(int n); //DLLExport int GetAssetReferenceName(le3::MediaReference* assetreference); //DLLExport int CountAssetReferenceInstances(le3::MediaReference* assetreference); //Asset DLLExport int GetAssetName(le3::Media* asset, char* s, int length); DLLExport le3::MediaReference* GetAssetAssetReference(le3::Media* asset); DLLExport int ReloadAsset(le3::Media* asset, int flags); //Shader DLLExport le3::Shader* CreateShader(); DLLExport le3::Shader* LoadShader(char* path, int flags); DLLExport void SetShader(le3::Shader* shader); //DLLExport int ReloadShader(le3::Shader* shader, int flags); DLLExport int SetShaderFloat(le3::Shader* shader, char* name, float f); DLLExport int SetShaderVec2(le3::Shader* shader, char* name, float x, float y); DLLExport int SetShaderVec3(le3::Shader* shader, char* name, float x, float y, float z); DLLExport int SetShaderVec4(le3::Shader* shader, char* name, float x, float y, float z, float w); DLLExport int SetShaderMat4(le3::Shader* shader, char* name, le3::Mat4* mat); DLLExport void FreeShader(le3::Shader* shader); DLLExport int GetShaderSource(le3::Shader* shader, int shaderid, char* s, int length); DLLExport int GetShaderError(le3::Shader* shader, char* s, int length); DLLExport void SetShaderSource(le3::Shader* shader, char* source, int shaderid); DLLExport int CompileShader(le3::Shader* shader, int shaderid); DLLExport int LinkShader(le3::Shader* shader); //Texture DLLExport int GetTextureTarget(le3::Texture* texture); DLLExport le3::Texture* LoadTexture(char* path, int flags); DLLExport le3::Texture* CreateTexture(int width, int height, int format, int flags, int frames); //DLLExport void LockTexture(le3::Texture* texture, int miplevel, int framenumber); //DLLExport void UnlockTexture(le3::Texture* texture, int miplevel, int framenumber); //DLLExport void WriteTexturePixel(le3::Texture* texture, int x, int y, int r, int g, int b, int a, int miplevel, int framenumber); //DLLExport int ReadTexturePixel(le3::Texture* texture, int x, int y, int miplevel, int framenumber); DLLExport void GetTexturePixels(le3::Texture* texture, char* buf, int miplevel, int framenumber, int cubeface); DLLExport void SetTexturePixels(le3::Texture* texture, char* buf, int miplevel, int framenumber, int cubeface); DLLExport int GetTextureWidth(le3::Texture* texture, int miplevel); DLLExport int GetTextureHeight(le3::Texture* texture, int miplevel); DLLExport void FreeTexture(le3::Texture* texture); DLLExport void SetTextureFilter(le3::Texture* texture, int filter); //DLLExport int TextureLocked(le3::Texture* texture, int miplevel, int framenumber); //DLLExport int ReloadTexture(le3::Texture* texture, int flags); DLLExport void BindTexture(le3::Texture* texture, int index); DLLExport char* GetTextureData(le3::Texture* texture, int miplevel, int framenumber); DLLExport int CountTextureMipmaps(le3::Texture* texture); DLLExport int GetTextureFormat(le3::Texture* texture); DLLExport int GetTextureMipmapSize(le3::Texture* texture, int mipmap); DLLExport void SetTextureClampMode(le3::Texture* texture, int x, int y, int z); DLLExport int GetTextureClampMode(le3::Texture* texture, int axis); DLLExport float GetTextureAnisotropy(le3::Texture* texture); DLLExport void SetTextureAnisotropy(le3::Texture* texture, float anisotropy); //Material DLLExport int MaterialContainsValue(le3::Material* material, const char* name); DLLExport void SetMaterialShader(le3::Material* material, le3::Shader* shader); DLLExport le3::Material* LoadMaterial(const char* path, int flags); DLLExport le3::Texture* GetMaterialTexture(le3::Material* material, int index); DLLExport void SetMaterialTexture(le3::Material* material, le3::Texture* texture, int index); //DLLExport int ReloadMaterial(le3::Material* material, int flags); DLLExport le3::Shader* GetMaterialShader(le3::Material* material); DLLExport void FreeMaterial(le3::Material* material); DLLExport void SetMaterialBlendMode(le3::Material* material, int mode); DLLExport int GetMaterialBlendMode(le3::Material* material); DLLExport void SetMaterialBackFaceCullMode(le3::Material* material, int mode); DLLExport int GetMaterialBackFaceCullMode(le3::Material* material); DLLExport void SetMaterialShadowMode(le3::Material* material, int mode); DLLExport int GetMaterialShadowMode(le3::Material* material); DLLExport void SetMaterialDepthTestMode(le3::Material* material, int mode); DLLExport int GetMaterialDepthTestMode(le3::Material* material); DLLExport void SetMaterialZSortMode(le3::Material* material, int mode); DLLExport int GetMaterialZSortMode(le3::Material* material); DLLExport void SetMaterialFloat(le3::Material* material, char* name, float x); DLLExport void SetMaterialVec2(le3::Material* material, char* name, float x, float y); DLLExport void SetMaterialVec3(le3::Material* material, char* name, float x, float y, float z); DLLExport void SetMaterialVec4(le3::Material* material, char* name, float x, float y, float z, float w); DLLExport float GetMaterialFloat(le3::Material* material, char* name); DLLExport void GetMaterialVec4(le3::Material* material, char* name, le3::Vec4* v); //Buffer DLLExport void GetBufferPixels(le3::Buffer* buffer, char* buf, int component); DLLExport void SetBuffer(le3::Buffer* buffer); DLLExport le3::Buffer* GetBuffer(); DLLExport int GetBufferWidth(le3::Buffer* buffer); DLLExport int GetBufferHeight(le3::Buffer* buffer); DLLExport le3::Buffer* CreateBuffer(int width, int height, int colortextures, int depthtexture, int multisamplemode); DLLExport le3::Texture* GetBufferColorTexture(le3::Buffer*, int index); DLLExport le3::Texture* GetBufferDepthTexture(le3::Buffer*); DLLExport void ClearBuffer(le3::Buffer* buffer, int mode); DLLExport void FreeBuffer(le3::Buffer* buffer); //World DLLExport le3::World* CreateWorld(); DLLExport void RenderWorld(); DLLExport void SetWorld(le3::World* world); DLLExport le3::World* GetWorld(); DLLExport void FreeWorld(le3::World* world); DLLExport void SetWorldAmbientLight(le3::World* world, float r, float g, float b, float a); //Entity DLLExport void SetEntityPosition(le3::Entity* entity,float x, float y, float z, int global); DLLExport void SetEntityRotation(le3::Entity* entity,float x, float y, float z, int global); DLLExport void GetEntityPosition(le3::Entity* entity, le3::Vec3* position, int global); DLLExport void GetEntityRotation(le3::Entity* entity, le3::Vec3* rotation, int global); DLLExport void GetEntityMatrix(le3::Entity* entity, le3::Mat4* mat); DLLExport void MoveEntity(le3::Entity* entity,float x, float y, float z, int global); DLLExport void TurnEntity(le3::Entity* entity,float x, float y, float z, int global); DLLExport void SetEntityMaterial(le3::Entity* entity, le3::Material* material); DLLExport le3::Material* GetEntityMaterial(le3::Entity* entity); DLLExport void GetEntityAABB(le3::Entity* entity, le3::AABB* aabb, int mode); DLLExport void FreeEntity(le3::Entity* entity); DLLExport void HideEntity(le3::Entity* entity); DLLExport void ShowEntity(le3::Entity* entity); DLLExport int CountEntityChildren(le3::Entity* entity); DLLExport le3::Entity* GetEntityChild(le3::Entity* entity, int n); DLLExport void SetEntityParent(le3::Entity* entity, le3::Entity* parent, int global); DLLExport void AlignEntityToVector(le3::Entity* entity, float x, float y, float z, int axis, float rate, float roll); //Pivot DLLExport le3::Pivot* CreatePivot(le3::Entity* parent); //Model DLLExport le3::Model* LoadModel(const char* path, int flags); DLLExport le3::Model* CreateModelSphere(int segments); DLLExport le3::Model* CreateCube(le3::Entity* parent); DLLExport void FlipModelNormals(le3::Model* model); //Camera DLLExport le3::Camera* CreateCamera(le3::Entity* parent); DLLExport void SetCameraRange(le3::Camera* camera, float nearrange, float farrange); DLLExport void GetCameraRange(le3::Camera* camera, le3::Vec2* range); DLLExport void SetCameraProjectionMode(le3::Camera* camera, int projectionmode); DLLExport int GetCameraProjectionMode(le3::Camera* camera); DLLExport void SetCameraClearColor(le3::Camera* camera, float r, float g, float b, float a); DLLExport void GetCameraClearColor(le3::Camera* camera, le3::Vec4* color); DLLExport void SetCameraZoom(le3::Camera* camera, float zoom); DLLExport float GetCameraZoom(le3::Camera* camera); DLLExport void SetCameraDrawMode(le3::Camera* camera, int drawmode); DLLExport void SetCameraFOV(le3::Camera* camera, float fov); DLLExport float GetCameraFOV(le3::Camera* camera); DLLExport void SetCameraMotionBlurMode(le3::Camera* camera, int mode); DLLExport void SetCameraViewport(le3::Camera* camera, float x, float y, float width, float height); DLLExport void GetCameraViewport(le3::Camera* camera, le3::Vec4* viewport); -
New here and wondernig about C# specifics
Josh replied to TheRhinoDude's topic in General Discussion
Leadwerks Engine 2 is written in BlitzMax, and happens to use an object-oriented design internally, not that it makes any difference. The DLL uses a procedural C interface because even different C++ compilers don't make compatible OO libs, much less OO libs for other languages. (The LE2 DLL is actually built with GCC, by the way.) Leadwerks Engine 3 is being written in C++ and will include a static lib with access to the engine classes, for use with C++. However, the compiled DLL will still use a procedural interface, for the same reasons LE2 does; there's no such thing as cross-language OO classes. In LE3, the only way to access the original object-oriented classes of a C++ library will be to import the static library into a C++ program. This is true of any library. There are other things you can do, like create a class wrapper in whatever language and make them call the procedural commands, but C++ is the only way to directly access them. If a wrapper is done right, it will make no difference to the programmer, and they can just happily call object-oriented classes without caring about the underlying design. I have not decided yet if a class wrapper will be provided for C#, but we do get requests for supporting that language more than any other. -
That's strange, I just tried uploading your .doc file and it worked fine.
-
It doesn't bother me, but if you want it private you can post it in the advanced discussion forum. The file was "unapproved", not deleted, so if you need to download it again it's still available. Not sure if it will show up for you or not, but it's on the server.
-
He won't be able to view it there. Please post it in the forum, not the code downloads section. I'll have the documentation database back up ASAP.
-
That would be really cool.
-
I just won't go there. I'm the staff, I can't point out the obvious joke here...
-
That seems quite low for 332 entities, but i can't tell anything else without examining the actual file in question,
-
I know you like the idea of programming with a visual designer, and it's a cool idea, but I don't think the outcome would be as good for my users. I think complex behaviors should be programmed and then combined and linked visually. I'm sure we'll learn more as time goes on and we see these systems in action.
-
It might be possible to make Lua automatically execute all outputs when a certain function is called. Otherwise, you'll just have something like this at the end of the Open() function: CallOutputs("Open") This can be extended in the future to take function arguments. The flowgraph isn't really about programming though, it's about connecting objects to make events occur.
-
Honestly, if you have to ask, you probably won't be able to write your own header file for a new language. You're much better off going with an officially supported language like Lua or C++.
-
That's fine to use, it's what the engine's copybuffer command uses internally: Function CopyBuffer(src:TBuffer,dst:TBuffer,flags=BUFFER_DEPTH|BUFFER_COLOR0|BUFFER_COLOR1|BUFFER_COLOR2|BUFFER_COLOR3) 'If src=BackBuffer() Return If src=dst Return Local buffer:TBuffer=GetBuffer() Local filter=GL_NEAREST Local temp:Int If src.width()<>dst.width() Or src.height()<>dst.height() filter=GL_LINEAR EndIf If (BUFFER_DEPTH & flags) If src.depthbuffer<>Null And (dst.depthbuffer<>Null Or dst=BackBuffer()) And (src.depthbuffer<>dst.depthbuffer) If dst=BackBuffer() Or glGetVendor()=VENDOR_ATI SetBuffer dst If Not Shader_DepthBlit Shader_DepthBlit=LoadShader("abstract::postfilter.vert","abstract::DepthBlit.frag") If Not Shader_DepthBlit AppLog "Failed to load shader.",APPLOG_ERROR Local shader:TShader=GetShader() ClearBuffer BUFFER_DEPTH SetShader Shader_DepthBlit glEnable GL_DEPTH_TEST glDepthMask True glColorMask False,False,False,False DrawImage src.depthbuffer,0,dst.height(),dst.width(),-dst.height() glDepthMask False glColorMask True,True,True,True glDisable GL_DEPTH_TEST SetShader shader SetBuffer Buffer BindTexture Null,0 Else glBindFramebufferEXT GL_READ_FRAMEBUFFER_EXT,src.framebuffer glBindFramebufferEXT GL_DRAW_FRAMEBUFFER_EXT,dst.framebuffer glBlitFramebufferEXT 0,0,src.width(),src.height(),0,0,dst.width(),dst.height(),GL_DEPTH_BUFFER_BIT,GL_NEAREST EndIf EndIf EndIf If (BUFFER_COLOR0 & flags) 'glReadBuffer GL_COLOR_ATTACHMENT0_EXT If dst=BackBuffer() If src.colorbuffer[0]<>Null SetBuffer(dst) Local shader:TShader=GetShader() SetShader Null temp=src.colorbuffer[0].reference.filter If filter=GL_LINEAR src.colorbuffer[0].reference.filter=TEXFILTER_SMOOTH Else src.colorbuffer[0].reference.filter=TEXFILTER_PIXEL DrawImage src.colorbuffer[0],0,dst.height(),dst.width(),-dst.height() SetShader shader src.colorbuffer[0].reference.filter=temp 'SetBuffer src 'glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT,0) 'glDrawBuffer(GL_BACK) 'SetBuffer Buffer EndIf Else If src=BackBuffer() And dst.colorbuffer[0]<>Null And (src.colorbuffer[0]<>dst.colorbuffer[0]) glBindFramebufferEXT GL_READ_FRAMEBUFFER_EXT,0 glBindFramebufferEXT GL_DRAW_FRAMEBUFFER_EXT,dst.framebuffer glReadBuffer GL_BACK glDrawBuffer GL_COLOR_ATTACHMENT0_EXT glBlitFramebufferEXT 0,0,src.width(),src.height(),0,0,dst.width(),dst.height(),GL_COLOR_BUFFER_BIT,filter ElseIf src.colorbuffer[0]<>Null And dst.colorbuffer[0]<>Null And (src.colorbuffer[0]<>dst.colorbuffer[0]) glBindFramebufferEXT GL_READ_FRAMEBUFFER_EXT,src.framebuffer glBindFramebufferEXT GL_DRAW_FRAMEBUFFER_EXT,dst.framebuffer glReadBuffer GL_COLOR_ATTACHMENT0_EXT glDrawBuffer GL_COLOR_ATTACHMENT0_EXT glBlitFramebufferEXT 0,0,src.width(),src.height(),0,0,dst.width(),dst.height(),GL_COLOR_BUFFER_BIT,filter EndIf EndIf EndIf If src<>BackBuffer() And dst<>BackBuffer() If (BUFFER_COLOR1 & flags) If dst=BackBuffer() Return If src.colorbuffer[1]<>Null And dst.colorbuffer[1]<>Null And (src.colorbuffer[1]<>dst.colorbuffer[1]) glBindFramebufferEXT GL_READ_FRAMEBUFFER_EXT,src.framebuffer glBindFramebufferEXT GL_DRAW_FRAMEBUFFER_EXT,dst.framebuffer glReadBuffer GL_COLOR_ATTACHMENT1_EXT glDrawBuffer GL_COLOR_ATTACHMENT1_EXT glBlitFramebufferEXT 0,0,src.width(),src.height(),0,0,dst.width(),dst.height(),GL_COLOR_BUFFER_BIT,filter EndIf EndIf If (BUFFER_COLOR2 & flags) If dst=BackBuffer() Return If src.colorbuffer[2]<>Null And dst.colorbuffer[2]<>Null And (src.colorbuffer[2]<>dst.colorbuffer[2]) glBindFramebufferEXT GL_READ_FRAMEBUFFER_EXT,src.framebuffer glBindFramebufferEXT GL_DRAW_FRAMEBUFFER_EXT,dst.framebuffer glReadBuffer GL_COLOR_ATTACHMENT2_EXT glDrawBuffer GL_COLOR_ATTACHMENT2_EXT glBlitFramebufferEXT 0,0,src.width(),src.height(),0,0,dst.width(),dst.height(),GL_COLOR_BUFFER_BIT,filter EndIf EndIf If (BUFFER_COLOR3 & flags) If dst=BackBuffer() Return If src.colorbuffer[3]<>Null And dst.colorbuffer[3]<>Null And (src.colorbuffer[3]<>dst.colorbuffer[3]) glBindFramebufferEXT GL_READ_FRAMEBUFFER_EXT,src.framebuffer glBindFramebufferEXT GL_DRAW_FRAMEBUFFER_EXT,dst.framebuffer glReadBuffer GL_COLOR_ATTACHMENT3_EXT glDrawBuffer GL_COLOR_ATTACHMENT3_EXT glBlitFramebufferEXT 0,0,src.width(),src.height(),0,0,dst.width(),dst.height(),GL_COLOR_BUFFER_BIT,filter EndIf EndIf EndIf SetBuffer(buffer) EndFunction
-
You could call Open() and Close() from other scripts, or from a C++ program (something like entity->CallActor("Open")) but I think we've found none of those approaches really make game interactions very easy. You generally don't know what functions other script objects have, and making generic "Activate" and "Enable" functions for each one doesn't seem to yield very good results, either. My primary concern for Leadwerks Engine 3 is that historically, with every 3D engine or game creation system, only about 10% of the users can successfully create game interactions with them. Then there are ones that make it easy to do a few pre-programmed interactions, but very few can make anything of their own and most end up with very few changes to the original. This is a huge problem. So keeping that in mind, the main way to access the script functions of an entity is through the flowgraph, which I will show as it develops. You script your behavior, attach it to an entity, and then you can control the way things interact visually. There's no guessing what the door's functions are, or checking the script, because it appears right in the flowgraph editor, so it's obvious. So you have a scripted button, and this scripted door, and they can be combined without even looking at the scripts. So right off the bat, a non-programmer can control interactions in a way that's beyond what most programmers currently do, including myself. It's not like it's hard to program that specific behavior, but without a general interactions system, it's just so much trouble that you generally don't bother to do it. The idea in LE2 was that the script function for SetEntityKey() could be used for this kind of functionality, but I think without a visual display of everything you have access to, it's not much fun. This also opens up Leadwerks Engine to a new category of users: designers. They can take place objects in a scene, attach scripts, and set up their interactions without looking at one line of code. This is actually pretty efficient because a script programmer can design different behaviors, and then give them to the designer to produce a level. I think this will also facilitate code sharing. Sure, I can program my own stuff, but it would be cool to just download a useful script and play with it, knowing I'm not going to have a bunch of incompatibilities or requirements. I plan on providing some generic "mover" scripts that handle movement interpolation. You just set a few values in the editor the script handles the rest.
-
In Leadwerks Engine 3, you can load a script and attach it to any entity. You can attach multiple scripts to any entity, and they will be called in the order they were attached. Right now, I am calling the script-side table "actor" because it is a little more descriptive than "object" but I'm not sure about all the syntax yet. Below is a sample script for a sliding door. When you attach this to a model, the script will control its behavior: ----------------------------- -- Sliding door script ----------------------------- --Attach this to any entity to turn it into a sliding door. --You can make the door move in any direction by adjusting the movement vector. --When the door opens or closes, a one-shot noise will play, along with looping --sound that will continue until the door comes to rest. --expose Sound opennoise --expose Sound closenoise --expose Sound movenoise --expose Sound stopnoise --expose Vec3 movement --expose function Open --expose function Close function actor:Start() if self.movement~=nil then self.openposition = self.entity.position + movement self.closeposition = self.entity.position end end function actor:Open() if self.openstate==0 then self.movestate=1 --Play one-shot noise, if it is set if self.opennoise~=nil then self.entity:EmitSound(self.opennoise) end --Play looping move noise if it is set if self.movenoise~=nil self.movesource = self.entity:EmitSound(self.movenoise,true) end end end function actor:Close() if self.openstate==1 then self.movestate=-1 --Play one-shot noise, if it is set if self.closenoise~=nil then self.entity:EmitSound(self.closenoise) end --Play looping move noise if it is set if self.movenoise~=nil self.movesource = self.entity:EmitSound(self.movenoise,true) end end end function actor:Update() local d local l if self.movestate~=0 --Calculate the difference between where we are and where we should be if self.openstate==1 d = self.openposition - self.entity.position else d = self.closeposition - self.entity.position end --Check to see if there is any difference l=d:Length() if l>0 then --Limit the difference if it is greater than the move speed of the door l = d:Length() if l>self.movespeed d = d:Normalize() * l end self.entity:Move(d,false) else self.movestate=0 --Disable looping noise source if it exists if self.movesource~=nil then self.movesource:Stop() --Play one-shot stop noise if it exists if self.stopnoise~=nil then self.entity:Emit(self.stopnoise) end end end Lua is pretty flexible, so I can make it work pretty much any way we want. When designing stuff like this, I find it's best to start with what the end user wants, and then work your way backwards to make it happen. What do you think?
-
If you move it just a little each frame, it may push the objects up as it moves. Or you could check objects within the edited are and maybe adjust their height.
-
Whoops, that was my fault. The syntax highlighter had some bad code that was updating every line each time a character was pressed. Looks like it will be my first BMX multithreaded app. Nice to make use of that. It was always too slow for any intensive applications.