LDCad 1.4 Beta 2 (win+linux)

Re: LDCad 1.4 Beta 2 (win+linux)
I've looked into this a bit more and it turns out it's not a group matrix bug, it's event related. Nesting is fun but all the internal matrix stuff introduced rounding problems in my early alpha's after a couple of frames so I implemented caching etc. Problem is the current version only initializes this cache when the start event is used in your script. This is why my examples all work fine Smile

Anyhow a workaround is very simple, just add a (dummy) start event handler. Here is your corrected script it should work on your existing model without problems now.

function register()
  local ani=ldc.animation('42020-B')
  ani:setEvent('frame', 'onFrame')
  ani:setEvent('start', 'onStart')

function onStart()
  --grp ori bug prevention
function onFrame()
  local ani=ldc.animation.getCurrent()
  local mainSf=ldc.subfile()
  local ori=ldc.matrix()

  local angle=720*ani:getFrameTime()/ani:getLength()
  ori:set(0, 0, 1, 0, 1, 0, -1, 0, 0) --group has non id main item
  ori:mulRotateAB(angle, 1, 0, 0)
  local ax2=mainSf:getGroup('TopRotor')
  ori:set(0, 0, 1, -1, 0, 0, 0, -1, 0)  --group has non id main item
  ori:mulRotateAB(-angle, 0, 1, 0)
  local ax3=mainSf:getGroup('TailRotor')
  ori:setRotate(angle, 1, 0, 0)



I also corrected for the non id placements. The next version won't need the workaround anymore.
« Next Oldest | Next Newest »

Messages In This Thread
Re: LDCad 1.4 Beta 2 (win+linux) - by Roland Melkert - 2014-10-22, 19:15

Forum Jump:

Users browsing this thread: 2 Guest(s)