MidPos¶
A component meant to be programmatically added to an existing EntityControl's sprite
or via Unity to a model
entity prefab.
This component implements the ability for multiple Transform to be linked in such a way that it simulates a chain where each nodes is in a list of Transform and they move together. The logic is very complex so for the sake of brevity, only the public fields will be documented. The component has a Start and a LateUpdate (where most of the logic happens).
Here are the public fields and their effects:
links
: The list of Transform to link together. Ifgetfromchild
is true, this will be set to all the child Transform on Startstart
: The position of the start of the chain. Ifgetstartandendfromlink
is true, this will be overriden tolinks[0]
position. Iflocalpos
is true, this refers to the local position insteadend
: The position of the end of the chain. Ifgetstartandendfromlink
is true, this will be overriden to the lastlinks
element's position. Iflocalpos
is true, this refers to the local position insteadmiddle
: If the magnitude of this is above 0.1, the chain will form a BeizierCurve3 from start to end with this value being the midpoint of the curve. Otherwise, the chain will move form a straight line using a lerplocalpos
: If true,start
andend
refers to the local position of the chain instead of the positiongetstartandendfromlink
If true,start
andend
are overriden tolinks[0]
position and the lastlinks
element position respectively (this is incompatible withlocalpos
being true)getfromchild
: If true,links
will be set to all child Transform on Startismodel
If true andparenttransform
isn't null, the related EntityControl (used to determined if theirsprite
hasflip
) is assumed to be in the grand grand parent ofparenttransform
. Otherwise, it's assumed to be int theparenttransform
directlyparenttransform
: If this isn't null, the Transform where an EntityControl resides related to the chain (ifismodel
is also true, it's assumed to be on its grand grand parent instead)