Chain/track animation in LDCad


RE: Chain/track animation in LDCad
#5
(2016-05-17, 22:11)Roland Melkert Wrote:
(2016-05-17, 20:55)Gret Rumpel Wrote: Hi Roland,
Thank you for the fast reply. Actually I hoped for you to answer Smile
First of all congratulations for LDCad effort. It's a great piece of software.
To be more specific I'm working on a revised version of 42042 Crawler crane's track drive. The factory layout features jointly driven tracks thus it could go only straight forth and back.
I used LDCad to build a complete model of a real track drive which consists of two motors, transverse subtractor and two reductors  (one for each track).
I managed to animate all gears - from input drive shafts down to drive sprocket wheels on the tracks.
And here I stuck Huh
I'll try to post some pictures or even a clip if I manage to export it Wink
So I really hope you to be more specific on how to animate tracks.
How to get instance and manipulate a single track element?

Regards.

P.S.
To be honest I am new to LDraw and 3D modeling.
But in my opinion LDCad has a fast learning curve which helped me a lot.

Thanks Gret.

If you used a template for the chain you could make it move fairly easy in the new 1.6 Alpha but a bug I discovered trying this out spoils it all it will work as expected in the next version though.

Here's the script. I used Philo's 42042.mpd as found here: http://omr.ldraw.org/set/42042-1/  It just needs an additional group for the first point of the track.

Code:
function onFrame()

 local ani=ldc.animation.getCurrent()
 local angle=ani:getFrameTime()/ani:getLength()*360 --current angle of the wheel around the first chain point.

 local linkLen=30 --length of single chain segment.
 local pntRadius=50  --current radius of the first path point.
 local linkAngle=math.deg(math.tan(linkLen/pntRadius)) --angle difference on the wheel for a single link.
 local pntAngle=angle % linkAngle --frame's angle, this will create the illusion of a continues move around the whole chain.

 local chainSf=ldc.subfile('42042 - technicChainTread38Closed-1.ldr')
 local chainPnt=chainSf:getGroup('pnt1') --use a group as the current api can't set matrices for non references (is pending).
 
 --apply the angle this will trigger a path regeneration.
 local ori=ldc.matrix()
 ori:setRotate(pntAngle, 0, 0, 1)
 chainPnt:setOri(ori)
end

function register()
  local ani=ldc.animation('Chain')
  ani:setLength(10)
  ani:setEvent('frame', 'onFrame')
end

register()


The 1.5 way of doing it would involve setting up a manual chain (not generated). The easiest way of doing that would be to edit the mpd after using the template. Remove everything after "0 FILE"  up to "0 //Segments" to reduce the chain to a normal submodel.

After reloading the model you can access the individual links through a ldc.subfile object using the getRef('57518.dat', index) where index starts at 1 confirm the lua standard.

Once you got the links in an lua table you could do the individual math for each of them which won't be easy as you basically rewriting the generator.

Hi,
I used template to generate the tracks and v1.5 way of doing things seams to be very inefficient.
It's pretty clear how to achieve the goal in v1.6 so I will wait for its stable release.
It sounds very easy and native as well that when you move first point of the template the whole of it will be regenerated.
When do you think a stable v1.6 will be available?
Thank you for the assistance.
Regards.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Chain/track animation in LDCad - by Gret Rumpel - 2016-05-18, 20:34

Forum Jump:


Users browsing this thread: 1 Guest(s)