door mechanism


door mechanism
#1
Hi

this is nothing big. I just wanted to share a video of my first LDcad model. Since my first contact with LDraw.org I have the idea to design and hopefully later build a large spaceship. This door mechanism shall be integrated into it. A big thankyou to Roland for his great work. It is really fun to design things, to animate them and to render them. I just miss the space navigator integration  Big Grin

Regards
Joscha

Reply
RE: door mechanism
#2
VERY nice!
Reply
RE: door mechanism
#3
(2018-03-22, 17:08)Joscha Wrote: Hi

this is nothing big. I just wanted to share a video of my first LDcad model. Since my first contact with LDraw.org I have the idea to design and hopefully later build a large spaceship. This door mechanism shall be integrated into it. A big thankyou to Roland for his great work. It is really fun to design things, to animate them and to render them. I just miss the space navigator integration  Big Grin

Regards
Joscha

Very nice indeed.

I always wanted to draw/build an insanely large ship, something like the Red Dwarf.

fyi: In one episode they took the lift down to a remote deck which took so long they could watch a movie during the ride Big Grin
Reply
RE: door mechanism
#4
(2018-03-22, 20:25)Roland Melkert Wrote: Very nice indeed.

I always wanted to draw/build an insanely large ship, something like the Red Dwarf.

fyi: In one episode they took the lift down to a remote deck which took so long they could watch a movie during the ride Big Grin


omg, I had to google what the red dwarf is. Never heard about it before. I was more the Kirk fan.
Reply
RE: door mechanism
#5
Good work. Are you doing animations manually or by using a script, available online ?
Lego isn't just a brand of plastic bricks. It's a lifestyle; and artistic medium.
Reply
RE: door mechanism
#6
(2018-03-23, 9:47)Jarema Wrote: Good work. Are you doing animations manually or by using a script, available online ?

Thank you. I studied one of Roland's scripts and then adapted it respectively added the required movements.
Reply
RE: door mechanism
#7
Can you share you work with us ... or gave me a clue via PM how build this stuff by yourself ? Thanks again.
Lego isn't just a brand of plastic bricks. It's a lifestyle; and artistic medium.
Reply
RE: door mechanism
#8
(2018-03-24, 8:01)Jarema Wrote: Can you share you work with us ... or gave me a clue via PM how build this stuff by yourself ? Thanks again.

Here is the script. It has a lot from Roland's example for the 5580 Truck. Sorry, so far there are no comments inside.


Code:
function sineWave(time, freq, amp)
 return math.sin(time*freq*2*math.pi)*amp
end

function register()  
 local ani=ldc.animation('Demo')  
 ani:setLength(20)  
 ani:setEvent('start', 'onStart')  
 ani:setEvent('frame', 'onFrame')
end

function onStart()  
 local mainSf=ldc.subfile()  
 
 doorUpper=mainSf:getGroup('doorUpper')
 doorLower=mainSf:getGroup('doorLower')
 doorUpperPos=doorUpper:getPos()
 doorLowerPos=doorLower:getPos()

 axleUpper=mainSf:getGroup('axleUpper')
 axleLower=mainSf:getGroup('axleLower')
 axleVert=mainSf:getGroup('axleVert')  

 pneu_cyl=mainSf:getGroup('pneumatic_cylinder')
 pneu_pis=mainSf:getGroup('pneumatic_piston')

 axleUpperRestOri=axleUpper:getOri()
 axleLowerRestOri=axleLower:getOri()
 axleVertRestOri=axleVert:getOri()
 
 cylRestOri=pneu_cyl:getOri()
 pisRestOri=pneu_pis:getOri()
 pisPos=pneu_pis:getPos()


end

function calcDoors(displPerc)
 
 local wavedisp= -50*math.cos(displPerc/100*math.pi)+50

 local displ=64*wavedisp/100
 doorUpper:setPos(doorUpperPos:getAdd(0,displ,0))
 doorLower:setPos(doorLowerPos:getAdd(0,-displ,0))

 local oriUpper=ldc.matrix()
 local oriLower=ldc.matrix()
 local oriVert=ldc.matrix()
 local oriCyl=ldc.matrix()
 local oriPis=ldc.matrix()

 local angle=(360/16)/8*64*wavedisp/100
 
 oriUpper:set(axleUpperRestOri)
 oriUpper:mulRotateAB(angle,0,0,-1)
 axleUpper:setOri(oriUpper)

 oriLower:set(axleLowerRestOri)
 oriLower:mulRotateAB(angle,0,0,1)  
 axleLower:setOri(oriLower)

 local angleVert=16/24*(360/16)/8*64*wavedisp/100

 oriVert:set(axleVertRestOri)
 oriVert:mulRotateAB(angleVert,0,-1,0)
 axleVert:setOri(oriVert)

 local yPos=40*math.sin((30+angleVert)*math.pi/180)-20
 local xPos=40*math.cos(30*math.pi/180)-40*math.cos((30+angleVert)*math.pi/180)  
 local lengthA=120
 local lengthB=math.sqrt((120+xPos)^2+yPos^2)
 local lengthC=math.sqrt(xPos^2+yPos^2)
 local angleGamma=180/math.pi*math.acos((lengthA^2+lengthB^2-lengthC^2)/(2*lengthA*lengthB))

 oriCyl:set(cylRestOri)
 oriCyl:mulRotateAB(angleGamma,0,1,0)
 pneu_cyl:setOri(oriCyl)
 
 oriPis:set(pisRestOri)
 oriPis:mulRotateAB(angleGamma,0,1,0)
 pneu_pis:setOri(oriPis)
 pneu_pis:setPos(pisPos:getAdd(yPos,0,xPos))
end



function calcUpDownAngle(curTime, ofs, len, minAngle, maxAngle)
 
 if (curTime<=ofs) then
   return minAngle
 else
   local endTime=ofs+len
   if (curTime>=endTime) then
     return minAngle
   else
     local relTime=curTime-ofs
     local subLen=0.5*len
     if (relTime<subLen) then
       return minAngle+(maxAngle-minAngle)*relTime/subLen
     else
       return maxAngle-(maxAngle-minAngle)*(relTime-subLen)/subLen
     end
   end
 end
end



function onFrame()
 
 local ani=ldc.animation.getCurrent()  
 local curTime=ani:getFrameTime()
 local totTime=ani:getLength()
 
 calcDoors(calcUpDownAngle(curTime, 0, 20, 0, 100))
 
end
register()
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)