Rick Stirling
12-12-2007, 10:44 AM
I've got a function that gives me the x,y,z position of a Biped/CS bone, but it's UGLY. It works, but it's always annoyed me that it felt so hacky.
It basically converts the biped information into a string, parses it, then rebuilds the x, y and z components into a point3.
Can anyone suggest a way to clean it up?
fn getbipedpos bipbone = (
-- taking in a bone, convert it to a string, parse the position
print bipbone
bbs = bipbone as string
t = filterstring bbs "["
co = filterstring t[2] ",]"
xc = co[1] as float
yc = co[2] as float
zc = co[3] as float
p3 = [xc,yc,zc]
return p3
)
It basically converts the biped information into a string, parses it, then rebuilds the x, y and z components into a point3.
Can anyone suggest a way to clean it up?
fn getbipedpos bipbone = (
-- taking in a bone, convert it to a string, parse the position
print bipbone
bbs = bipbone as string
t = filterstring bbs "["
co = filterstring t[2] ",]"
xc = co[1] as float
yc = co[2] as float
zc = co[3] as float
p3 = [xc,yc,zc]
return p3
)
