Argorius Posted January 17, 2010 Share Posted January 17, 2010 I am trying to get animation to work on the crawler in lua - could someone post their lua script for an animated character model? I would like to use it as a template for mine and learn from it. At the moment I have no idea what exactly I need to code this and what all goes in it! Quote Windows XP Home Edition Service Pack 3/ Intel Q9450 @ 2.67GHz / 3.5GB DDR3 SDRAM / GeForce 8800 GTS 512 Link to comment Share on other sites More sharing options...
Marleys Ghost Posted January 17, 2010 Share Posted January 17, 2010 Have a look HERE. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
VicToMeyeZR Posted January 17, 2010 Share Posted January 17, 2010 Thats what I thought 2 days ago. It really is easy, well easier than I thought at first. I do still have a lot to add to it, and I plan to integrate Rick's character scripts in a way to control the character better. Quote AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD Link to comment Share on other sites More sharing options...
Rick Posted January 17, 2010 Share Posted January 17, 2010 I do still have a lot to add to it, and I plan to integrate Rick's character scripts in a way to control the character better. I'm excited to see what you come up with man! Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 17, 2010 Share Posted January 17, 2010 I use this code for looped animation: require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) function object:Render() frame = (AppTime()/34.0) % (120-0) + 1 model:Animate( frame, 1,0, 1 ) end function object:Free(model) self.super:Free() end end Quote Link to comment Share on other sites More sharing options...
Argorius Posted January 18, 2010 Author Share Posted January 18, 2010 Thanks! Great examples. The shorter one works great (but I havent been able to use it on my Dexsoft model - but I probably didnt do the conversion right). The longer one gives an error (I fixed what was wrong with it as suggested). An empty box pops up and wants me to hit OK. I'll have to dissect that and see if I can make it work. Quote Windows XP Home Edition Service Pack 3/ Intel Q9450 @ 2.67GHz / 3.5GB DDR3 SDRAM / GeForce 8800 GTS 512 Link to comment Share on other sites More sharing options...
Michael Betke Posted January 18, 2010 Share Posted January 18, 2010 Thanks for the script Aggor. Could you please go intop detail what this does: function object:Render() frame = (AppTime()/34.0) % (120-0) + 1 model:Animate( frame, 1,0, 1 ) I would like just to run frame 1-500. What should I enter?! Quote Pure3d Visualizations Germany - digital essences AAA 3D Model Shop specialized on nature and environments Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 18, 2010 Share Posted January 18, 2010 Thanks for the script Aggor. Could you please go intop detail what this does: function object:Render() frame = (AppTime()/34.0) % (120-0) + 1 model:Animate( frame, 1,0, 1 ) I would like just to run frame 1-500. What should I enter?! Sorry I should have explained it a bit better. This line frame = (AppTime()/34.0) % (120-0) + 1 should be used as follow: frame = (AppTime()/speed of animation) % (endframe-startframe) + startframe In your case: frame = (AppTime()/50.0) % (500-0) + 1 I don't know more then that at the moment. I'll try to work out how this exactly works. Using the Render function like this will result in an enormous speed increase (got that line from Josh), because you can have tons of offscreen characters that don't have to be animated. Quote Link to comment Share on other sites More sharing options...
Michael Betke Posted January 18, 2010 Share Posted January 18, 2010 Thanks. THis is good enought for me to mess around with it. Quote Pure3d Visualizations Germany - digital essences AAA 3D Model Shop specialized on nature and environments Link to comment Share on other sites More sharing options...
VicToMeyeZR Posted January 18, 2010 Share Posted January 18, 2010 The longer one gives an error (I fixed what was wrong with it as suggested). An empty box pops up and wants me to hit OK. I'll have to dissect that and see if I can make it work. That was a debug so I could see if my value of framestart or frameend was being set... I you find the Notify() and put a -- in front of it, and change this line: function object:GetKey(key,value) if key=="idle_start" then return self.idle_start elseif key=="idle_end" then return self.idle_start to : function object:GetKey(key,value) if key=="idle_start" then return self.idle_start elseif key=="idle_end" then return self.idle_end It will work. Then you can double click in the character in the objects window, and set your frame start and ends for each function. Right now, all the guy does is idle animate, and yes its a dexsoft model, so theirs do work, just requires little fix with the textures. When I get the controller to work with this, I will post it again for everyone to play with if they want. Quote AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD Link to comment Share on other sites More sharing options...
VicToMeyeZR Posted January 18, 2010 Share Posted January 18, 2010 I'm excited to see what you come up with man! Me to. I really like Lua. mostly because I am a scripter, not a programmer. lol Quote AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.