Jump to content

Could someone post their animation lua script as an example?


Argorius
 Share

Recommended Posts

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!

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

Have a look HERE.

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

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

Link to comment
Share on other sites

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.

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

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?!

Pure3d Visualizations Germany - digital essences

AAA 3D Model Shop specialized on nature and environments

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 

 

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.

AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD

76561197984667096.png

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...