Setting a variable to a bone fPos... issue solved
Posted: Sun May 13, 2007 7:12 am
I was having trouble with the following code:
It caused a big problem with the bones fPos and how it moved the vector points.
I could not get around this. It seems that copying the bone position to a variable in conjunction with transforming the variable from the parent bone was effecting the bones fPos.
I finally found an alternate way to "copy" the bone fPos to a variable:
By setting the variable vec2 individual x and y attributes separately it works.
There are several scripts that are effected by this. The TransRotate and RotateTrans that Rasheed and I have been working on. I plan to update those so they work properly.
This is a major breakthrough for me. I'm very happy.
I hope this might help others doing lua scripting.
-vern
Code: Select all
local pBone1 = skel:Bone(mstr2.fParent)
local vec2 = LM.Vector2:new_local()
vec2:Set(mstr2.fPos)
pBone1.fMovedMatrix:Transform(vec2)
I could not get around this. It seems that copying the bone position to a variable in conjunction with transforming the variable from the parent bone was effecting the bones fPos.
I finally found an alternate way to "copy" the bone fPos to a variable:
Code: Select all
local pBone1 = skel:Bone(mstr2.fParent)
local vec2 = LM.Vector2:new_local()
vec2.x = mstr2.fPos.x
vec2.y = mstr2.fPos.y
pBone1.fMovedMatrix:Transform(vec2)
There are several scripts that are effected by this. The TransRotate and RotateTrans that Rasheed and I have been working on. I plan to update those so they work properly.
This is a major breakthrough for me. I'm very happy.
I hope this might help others doing lua scripting.
-vern