MAXScript101 3.2_Working With Controllers

本文介绍了MAXScript中如何操作控制器,包括给属性分配控制器、创建路径约束、调整控制器参数以及复制控制器实例。同时讲解了获取和修改关键帧的方法,包括关键帧的类型、属性和用例。此外,还提供了一个围绕物体移动相机的函数示例,展示了控制器在动画中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MAXScript101 3.2_Working With Controllers
-- Add & Delete key frames, manipulate key parameter

 

 

1. controller

【译】The track property is a simple synonym for controller. If an animatable property does not yet have a controller assigned, the isAnimated property returns false and the controller, track, and keys properties return undefined.

 

轨道(track)属性是控制器(controller)的别名。如果一个可动画属性还没有赋予控制器的话,<property>.isAnimated 返回false, controller, track, keys 返回undefined。

 

-- Controller Operation (1): assign a controller to a variable, any animatable property has controller
c = $Box01.height.controller -- return: undefined

 

-- Controller Operation (2): construct a path_constraint controller
pc = path_constraint follow: true bank: true path: $line01
$Box01.pos.controller = pc

 

-- Controller Operation (3): access and adjust controllers paramters
$Box01.pos.controller.bankAmount -=0.25

 

-- Controller Operation (4): copy controller instance using =, or copy
$Box01.scale.controller = $Box02.scale.controller

if $Box01.height.controller == undefined then
(
$Box01.height.controller = noise_float frequency: 0.74 fractal: false
$Sphere01.radius.controller = copy $Box01.height.controller
)

 

2. get keys
MAXScript有三类关键帧:
Bezier
TCB
Barycentric Morph

 

key有三个属性值:
.time -- which holds the time of the key
.value -- which holds the keys value, and
.selected -- which is true or false if the key is selected or not

 

eg.
animate on for i in 0 to 100 by 20 do
at time i
(
scale $Sphere01 [1.1, 1.1, 1.1]
)

keys = $Sphere01.scale.controller.keys -- #keys(0f, 20f, 40f, 60f, 80f, 100f)
keys[1] -- #Bezier Scale key(1 @ 0f)
-- can print or assign the property of keys
keys[1].time -- 0f
keys[1].value -- [1.77156,1.77156,1.77156]
keys[1].selected -- false
for k in keys do format "% at %/n" k.value k.time
--[1.77156,1.77156,1.77156] at 0f
--[1.94872,1.94872,1.94872] at 20f
--[2.14359,2.14359,2.14359] at 40f
--[2.35795,2.35795,2.35795] at 60f
--[2.59374,2.59374,2.59374] at 80f
--[2.85312,2.85312,2.85312] at 100f


3. 实例
1)物体的上方(即它的z轴方向)有一个圆形轨道;圆心为物体中心上方(与相机等高),半径为摆好初始位置时,相机的位置到圆心的距离;
2)在相机进行step 时,target位置始终在物体中心位置,相机step的位置为圆形轨道的lengthInterp点
3)该函数的使用比较一般性,当stepsNum个数较大时,变成了相机的旋转
4)lengthInterp点的个数等于关键帧的个数,在这里是stepsNum


 

 

4. 有关time, key, controller 操作,详细查询MAXScript Reference 相关主题:
. Controller Key Functions: eg. addNewKey ...
. Controller Time Functions: eg. getTimeRange ...
. Controller Common Properties, Operators and Methods: eg. <controller>.keys ...
. Controller Out-Of-Range Functions: eg. getBeforeORT...

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值