Message 1 of 1
Script Controller
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In the list of controllers in position I have a script controller that indicates that rotating the jaw object moves the object that contains the script controller, it adjusts its position a little bit. I am using it and it works very well.
The question is how to convert the script controller to wire parameter?
I'm looking for a way to do the same but using wire parameters.
Should I connect each axis separately using wire parameters?
Script controller :
v = v_pos.value
if v.z<f0 then z=v.z*0.2-f0 else if v.z>f0 then z=v.z*0.01-f0 else z=0
if v.x<f0 then x=-v.x*0.2-f0 else if v.x>f0 then x=-v.x*0.2-f0 else x=0
if v.y<f0 then y=v.y*-5.0-f0 else if v.y>f0 then y=-v.y*5-f0 else y=0
[x, z+y+y, y]
I am using this form of wire parameters in position, thanks to denisT.
fn getscriptpos v_pos f0:[0,0,0] =
(
v = v_pos
v.x = if v.x < f0.x then v.x =-v.x*0.5-f0.x else if v.x>f0.x then x=-v.x*0.5-v.z/5-f0.x else x=0
v.y = if v.y < f0.y then v.y = -v.y*0.3-f0.y else if v.y>f0.y then y=-v.y*0.3-f0.y else y=0
v.z = if v.z < f0.y then v.z = v.z*1*0.5-f0.z else if v.z>f0.z then z=v.z*1*0.9-f0.z else z=0
v - f0
)
getscriptpos Position_wire