Motor animation


Motor animation
#1
Hi everyone,
I am wondering how is it possible to animate motor in LDCad?
I found great LDCAD animation on youtube :

I found Scripting API on Melkert website 

Here the model:
[Image: Motor_animation_view.png]

I am able to rotate the camshaft with this script:

Code:
--[[Sripted by Co for NEMOOZ]]
function register()

--****************************************************************************************
-- "Dissolve" script makes parts disappear progressively from the model ("Build" inverse)
--****************************************************************************************
    local ani=ldc.animation('Motor')

   --Set the length of the animation in seconds
   ani:setLength(10)
    
   ani:setEvent('start', 'motorStart')
   ani:setEvent('frame', 'motorFrame')
end

function motorStart()
     mainSf=ldc.subfile()
end

function motorFrame()

   local ani=ldc.animation.getCurrent()
   local ori=ldc.matrix()
 
   local angle=1800*ani:getFrameTime()/ani:getLength()
   
   local ax1=mainSf:getRef('axe_motor.ldr')
   ori:setRotate(angle, 1, 0, 0)
   ax1:setOri(ori)
end

register()


I searched the forums and found nothing on that particular subject.

Regards


Attached Files
.zip   Motor_animation.zip (Size: 921.15 KB / Downloads: 11)
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Motor animation - by NEMOOZ - 2018-07-29, 19:04
RE: Motor animation - by Roland Melkert - 2018-07-31, 11:22
RE: Motor animation - by NEMOOZ - 2018-08-07, 18:33
RE: Motor animation - by Roland Melkert - 2018-08-07, 18:49
RE: Motor animation - by NEMOOZ - 2018-09-02, 13:56
RE: Motor animation - by Roland Melkert - 2018-09-02, 19:10

Forum Jump:


Users browsing this thread: 5 Guest(s)