You know 3 first columns are rotation matrix . Sent from my iPhone
On Apr 8, 2011, at 12:22 PM, John Brookes <jbp...@googlemail.com> wrote: > Going off topic from the thread > > Just playing with what you did keeping both x and z parallel. Forgeting about > looking at a target for now. > > In papervison there was copy3x3Matrix, which was handy for that sort of thing. > Basically invert the parent then copy the 3x3Matrix(rotation) to the child. > > So how is that done in AS3? > > I can do it like this > > var m3:Matrix3D = Matrix3D(container.transform).clone(); > m3.invert() > > var raw:Vector.<Number> = Matrix3DUtils.RAW_DATA_CONTAINER; > childObject.transform.copyRawDataTo(raw); > > raw[uint(0)] = m3.rawData[0] > raw[uint(1)] = m3.rawData[1] > raw[uint(2)] = m3.rawData[2] > > raw[uint(4)] = m3.rawData[4] > raw[uint(5)] = m3.rawData[5] > raw[uint(6)] = m3.rawData[6] > > raw[uint(8)] = m3.rawData[8] > raw[uint(9)] = m3.rawData[9] > raw[uint(10)] = m3.rawData[10] > > Matrix3D(childObject.transform).copyRawDataFrom(raw); > > > And that works. > > In the new flash Player there is now copyColumnTo and copyColumnFrom. > So shirley this should do the same > > var m3:Matrix3D = Matrix3D(container.transform).clone(); > m3.invert() > > var childCloneM3:Matrix3D = Matrix3D(childObject.transform).clone(); > > var xAxis:Vector3D = new Vector3D() > m3.copyColumnTo(0, xAxis); > childCloneM3.copyColumnFrom(0, xAxis); > > var yAxis:Vector3D = new Vector3D() > m3.copyColumnTo(1, yAxis); > childCloneM3.copyColumnFrom(1, yAxis); > > var zAxis:Vector3D = new Vector3D() > m3.copyColumnTo(2, zAxis); > childCloneM3.copyColumnFrom(2, zAxis); > > var pos:Vector3D = new Vector3D() > m3.copyColumnTo(3, pos); > trace(pos) > childCloneM3.copyColumnFrom(3, pos); > > childObject.transform = childCloneM3; > > > Notice the postion is not copied, weird. >