对象保持在另一个动画对象的两个多边形之间的特定距离

时间:2016-07-31 06:39:03

标签: maxscript

我有一个球体,我在两个多边形之间放置一个物体,内部物体不在它们之间的中间距离,但它们之间的距离是特定的比例,我想要做的就是保持当我同时移动或缩放球体时,内部物体的距离比是否相同?

2 个答案:

答案 0 :(得分:0)

最简单的方法是为面使用两个额外的点帮助器,使用这个可以使用简单的位置脚本来计算它。示例显示我在说什么:

(
    delete objects
    local sphere1 = Sphere segments:32 radius:10 pos:[35, 65, 0]
    local sphere2 = Sphere segments:32 radius:20 pos:[20, 5, 15]
    local point01 = Point wirecolor:green
    local point02 = Point wirecolor:green
    local point03 = Point size:5 box:on wirecolor:red

    point01.position.controller = Attachment node:sphere1 align:false
    point02.position.controller = Attachment node:sphere2 align:false

    local face1 = AttachCtrl.addNewKey point01.position.controller 0
    local face2 = AttachCtrl.addNewKey point02.position.controller 0

    face1.face = 440
    face1.coord = [0.5, 0]

    face2.face = 540
    face2.coord = [0.5, 0]

    local ctrl = Position_Script()
    ctrl.addObject #point01 point01
    ctrl.addObject #point02 point02
    ctrl.script = "point01.position + 0.8 * (point02.position - point01.position)"
    point03.position.controller = ctrl
)

答案 1 :(得分:0)

感谢我的朋友,我有这个想法并且完美地执行了:

fn obb obj nod r t=

(     全局x1p = nod.pos     global v1p = polyOp.getFaceCenter obj r     global v2p = polyOp.getFaceCenter obj t )
fn obbnew obj nod r2 t2 s1 s2 s3 = (     global v1p2 = polyOp.getFaceCenter obj r2     global v2p2 = polyOp.getFaceCenter obj t2     全局c1 =(s2 + s3)/ 2     全局c2 =(v1p2 + v2p2)/ 2     global cn = c2-c1     nod.pos = S1 + CN

rollout getset“Alaa Biped”宽度:285高度:325 (     按钮btn1“老pos骨”pos:[22,16]宽度:126高度:34     按钮btn2“new pos”pos:[24,88]宽度:126高度:34     label lbl1“”pos:[66,58] width:36 height:21     标签lbl2“”pos:[67,133]宽度:36高度:21     在btn1上按下了     (         --- lCollar         obb $ character $ PtlCollar 8958 9498         全局x1 = x1p         全球y1 = v1p         全球z1 = v2p         lbl1.caption = “OK”     )     在btn2上按下了吗     (         obbnew $ character $ PtlCollar 8958 9498 x1 y1 z1         lbl2.caption = “OK”     )

) createDialog getset - 设置骨盆pos

- 全部改变

- 导入皮肤