Scott Richmond Posted December 9, 2009 Share Posted December 9, 2009 Would have thought someone would have brought this up but apparently not (I gave it a good search). How does one animation models via LUA? 1 1 Quote Programmer, Modeller Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64 Visual Studio 2008 | Photoshop CS3 | Maya 2009 Website: http://srichnet.info Link to comment Share on other sites More sharing options...
Rick Posted December 9, 2009 Share Posted December 9, 2009 http://www.leadwerks.com/wiki/index.php?title=Entities#Animate Probably the same way you animated models using C++/BMax. I think your Animate() function would need to be in the entities Update() method since some values passed to Animate() will need to change each cycle. Quote Link to comment Share on other sites More sharing options...
TylerH Posted December 9, 2009 Share Posted December 9, 2009 I have animation working for both looped and one-shot animations in my Weaponwerks Library. For looping: frame = (AppTime()/100.0) % (endframe-startframe) + startframe For one shot animations: animstarttime = AppTime() -- Call this once when you first start the animation ... frame = ((AppTime()-animstarttime)/100.0) % (endframe-startframe) + startframe Then simply call model:Animate(frame,blend,0,1) In cases where you need to speed-up or slowdown the application, you multiply the value to the left of the % (modulus) sign by a speed factor. 1.0 plays at default (has no effect), 0.5 halves the speed, 2.0 doubles the speed, etc. If you need to compare the current frame (which is a floating point number) to a given frame (which is an integer) (i.e. I do this to check for sounds I have set to play at certain animation frames), round it to a whole frame using either math.ceil or math.floor (or code up a function like I did to ceil if the decimal place is .5 or higher and floor is less than .5) 1 Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Scott Richmond Posted December 9, 2009 Author Share Posted December 9, 2009 Ah fantastic work TylerH! Thanks mate, I'll give it a crack tonight. (May as well start using this rep system. +1 rep for you ) Quote Programmer, Modeller Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64 Visual Studio 2008 | Photoshop CS3 | Maya 2009 Website: http://srichnet.info Link to comment Share on other sites More sharing options...
TylerH Posted December 9, 2009 Share Posted December 9, 2009 Ah fantastic work TylerH! Thanks mate, I'll give it a crack tonight. (May as well start using this rep system. +1 rep for you ) Thanks Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Josh Posted December 30, 2009 Share Posted December 30, 2009 I would do your animation in the object:Render() function. That way animation only has to be performed on models that actually get drawn. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Scott Richmond Posted December 30, 2009 Author Share Posted December 30, 2009 I would do your animation in the object:Render() function. That way animation only has to be performed on models that actually get drawn. Hrm, are you able to point to an example of that function in use Josh? Quote Programmer, Modeller Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64 Visual Studio 2008 | Photoshop CS3 | Maya 2009 Website: http://srichnet.info Link to comment Share on other sites More sharing options...
macklebee Posted December 30, 2009 Share Posted December 30, 2009 Hrm, are you able to point to an example of that function in use Josh? firepit.lua Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel 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.