Page 3 of 4

Posted: Thu Apr 26, 2012 12:40 am
by Breinmeester
capricorn33 wrote:You know I'm having the exact same problem with another script that I am working on right now... Sorry Breinmeester, I don't have any answers to give you but I would ALSO be very, very interested - no, THRILLED - if anyone could share some kind of insight to this enigma (regarding how to get the position of a point affected by bones and layer transformation.... )
All this matrix stuff makes my brain hurt big time and I'm really worried that my head might be about to explode from trying to figure this out...

So if anyone can help out I can also promise to share a very cool arc tracking device when I'm finished with it... :-)
Hey Capricorn,
In my very sparse free time I managed to fool around with this a little and Ive found something that might be of use to you. It doesn't really work for what Im doing, but it might suffice your needs.

https://rapidshare.com/files/4250009215 ... racker.zip

Embed the script on the 'locator' layer and the layer translate will follow a point in the vector layer below, even when it's transformed using bones or layer transformations.

Code: Select all


	local mesh = moho:LayerAsVector(targetvectorlayer):Mesh()
	local pt = mesh:Point(1)
	local v = LM.Vector2:new_local()
	local dv = LM.Vector2:new_local()
	local k = LM.Vector3:new_local()
	local m = LM.Matrix:new_local()
	
	v:Set(pt.fAnimPos:GetValue(moho.frame))
	dv = pt.fPos - v
	
	-- Do transformations:
	targetvectorlayer:GetFullTransform(moho.frame, m, moho.document)
	m:Transform(v)
	v = v + dv
	
	k.x = v.x
	k.y = v.y
		
	-- Set result:
	thislayer.fTranslation:SetValue(moho.frame, k)


Posted: Thu Apr 26, 2012 7:39 am
by capricorn33
Breinmeester wrote: Ive found something that might be of use to you. It doesn't really work for what Im doing, but it might suffice your needs.

https://rapidshare.com/files/4250009215 ... racker.zip


Really? I have to try it out ASAP. :-)

There seems to be something wrong with that rapidshare link you provided... I tried in two different browsers and get file error in both... (?)

cap

Posted: Fri Apr 27, 2012 6:34 am
by capricorn33
ok, I got the rapidhare link at last... and...

- OMG OMG - it works!!! :shock:

This might be EXACTLY what I need to get my tracker script in order!
Fantastic, Breinmeester!

Too bad it doesn't solve your own problems with the multilayer-magnet, though...


Anyway, I'll be back just as soon as I have had a little time to experiment with this one. Might be a fully functional tracker tool coming up soon... 8)

Posted: Sat Apr 28, 2012 6:05 am
by Breinmeester
Well, I've found some problems with it. Especially a combination of layer rotate and bones doesn't seem to work.

I'll keep on searching.

Re: Multi layer Magnet Script?

Posted: Sun May 06, 2012 5:20 am
by capricorn33
Breinmeester,

I think I cracked it!
My pointtracking code works now, it reacts correctly to all
point / bone / layer transformation!

The problem, as I understood after having studied your code for a while and reading some of the old discussions on the subject, seemed to be that you have to use fPos, not fAnimPos, to get the bone influence included correctly in the transform.

I needed to collect positions from several frames for my tracking device, but since fPos only returns the current position from the current frame, I had to control the framevalue using SetCurFrame.

Something like this (a snippet from my pointtracker, the for-loop that is getting all the point position values):

Code: Select all


for frame = 0, moho.document:EndFrame() do
	moho:SetCurFrame(frame)
	pv = pt.fPos	
	layer:GetFullTransform(frame, m, moho.document)
	m:Transform(pv) 		
	-- ...and then on to draw()-routines using pv for positioning...

end
It simply works!

This means that the 'GetFullTransform' DOES work just as it should, and if you are having problems getting point positions to match across layers for your multilayer-magnet uses, then the problem is elsewhere.

I hope this is of any help to you, it certainly solved my problem completely.

A fully functional point tracking device is coming up soon!
:)

Re: Multi layer Magnet Script?

Posted: Sat Jun 03, 2017 12:32 am
by A.Evseeva
I suppose the problem with GetFullTransform() was that it considers camera transformation. After multiplication with inverted camera matrix it realy allows to get point positions to match across layers.
Please try my version of multilayer-magnet:
https://yadi.sk/d/zhWmkgtW3JnDz7

Re: Multi layer Magnet Script?

Posted: Sat Jun 03, 2017 11:32 am
by synthsin75
A.Evseeva wrote:I suppose the problem with GetFullTransform() was that it considers camera transformation. After multiplication with inverted camera matrix it realy allows to get point positions to match across layers.
Please try my version of multilayer-magnet:
https://yadi.sk/d/zhWmkgtW3JnDz7
Thanks for the script. I haven't tried it yet, but I did check it out so I could let others know there's nothing malicious in the code (can't always trust new members until we've got a chance to know them). For non-Russian members, to download, just click the underlined text (no need to install anything) and then the download button in the upper right hand corner.

Re: Multi layer Magnet Script?

Posted: Sat Jun 03, 2017 4:32 pm
by DK
Be very interested to hear your feedback on this script Wes.

Cheers
D.K

Re: Multi layer Magnet Script?

Posted: Sat Jun 03, 2017 6:36 pm
by synthsin75
DK wrote:Be very interested to hear your feedback on this script Wes.

Cheers
D.K
It doesn't play well with bones, and doesn't work at all with any layer rotation. So...not a finished tool, IMO.

But if you're only using it to move points of multiple layers on frame zero, it'll probably serve that purpose just fine.

Re: Multi layer Magnet Script?

Posted: Sat Jun 03, 2017 9:01 pm
by A.Evseeva
Synthsin75, thank You very much for testing.
My supposition about camera matrix was wrong. And I found a very strange thing:

Code: Select all

vec2:Set(vec1)
some_matrix:Transform(vec2)
some_matrix:Invert()
some_matrix:Transform(vec2)
It seems to me, vec2 must be equal to vec1 after these operations. But it does not.
Any ideas, what is wrong?

Re: Multi layer Magnet Script?

Posted: Sun Jun 04, 2017 2:33 am
by hayasidist
you might find this post in other other place useful ...

http://www.kelleytown.com/forum/animato ... hichpage=2

Re: Multi layer Magnet Script?

Posted: Sun Jun 04, 2017 8:30 am
by A.Evseeva
Wow! It was very, very useful!!
Now it seems to me the script can work with rotated layers.
New version is here: ae_magnet.lua
(Now it's on my own host, not yandex)

Re: Multi layer Magnet Script?

Posted: Mon Jun 05, 2017 1:34 am
by chucky
Hey guys!
Good to see you around again Cap!
and welcome to A.Evseeva what a great script to start with- unless you are an old dog with a new name of course. :wink:
Great to see this being worked on!
I LOVED the multilayer magnet in the LOST WIGGLE tool, it was a little fussy but was great for making smart actions for a bunch of phonemes.
So... I can't get this one to work yet though... what's the trick?

Any chance of a video tute if there is a special 'flick of the wrist' to make it work?

Re: Multi layer Magnet Script?

Posted: Mon Jun 05, 2017 4:35 am
by A.Evseeva
Chucky, what is your problem with it? Do You use it as a tool?
It is an improvment of built-in magnet tool, lm_magnet.lua, so you have to put it into tools folder, adding built-in icons and cursor to it (rename all the files the same way).

Re: Multi layer Magnet Script?

Posted: Mon Jun 05, 2017 4:51 am
by chucky
Yes I use it as a tool.
I have three layers ( in a group) all duplicates with the same vectors on them.
I use the multimagnet and select all three layers, then I pass the magnet over... only the top layers vectors move.

Do I completely misunderstand the tool?