我创建了以下脚本来按照我的导师的指示生成“烟花”(松散使用的术语)。它基于我必须使用的骨架脚本。
有微调器来控制某些参数,但是对于我的生活,我无法弄清楚出了什么问题!请帮我!!!
任务是通过脚本制作动画,这是一个向上的球体,面部“爆炸”并通过时间尺度向下改变方向。
(烟花升起,爆炸,碎片落到地上)
我相信我写的是正确的,但是实际上没有生成动画。尽管我尽了最大的努力和数月的辛勤工作。
我是编码新手,没有注册任何编码。我想做的就是学习如何建模。然而,我的导师掌握着我通行证的钥匙。
目前,我已经准备好“愤怒退出”,并且只是要离开我的矿井。任何帮助将不胜感激。
这是我到目前为止写的脚本...
-- Empty varables to be called in or adjusted by spinners
numOfSpheres = 0 --number of exploding spheres
sphereRadius = 0
creationBoxSize = 0 -- spawn radius in what box size?
objs = #() -- objs created go to empty array!
maxHeight = 0
startTime = 0
dropping = false --boolean flag to trigger the falling sphere stage
animate on
(
for i = 1 to numOfSpheres by 1 do
(
at time (startTime + 50.000) ( meshop.bevelFaces objs[i] #{1..objs[i].numFaces} 0.0000001 0 )
at time (startTime + 50.001) ( meshop.bevelFaces objs[i] #{1..objs[i].numFaces} 0.0000001 0 )
at time (startTime + 100) ( meshop.bevelFaces objs[i] #{1..objs[i].numFaces} 100 0 )
at time (startTime) ( objs[i].pos = objs[i].pos )
local height = maxHeight
for t = 5 to 100 by 5 do
(
height = height - 2
at time (startTime + t) ( objs[i].pos = objs[i].pos + [ 0, 0, height] )
)
)
)
rollout FireWorks "FireWorks"
( -- button ui code starts here
label lbl1 "By Luke Fahy" style_sunkenedge:true width:67 height:17
spinner count "FireWorks: " type:#integer range:[1,100,10] -- 1 to a 100: default value of 10: integer = whole number not fraction!
spinner size "Size: " type:#float range:[0.1,30,1]
spinner sPlane "Spawn Plane: " type:#integer range:[1,200,30]
spinner maxHeightSpinner "Max Height: " type:#float range:[1,100,14]
spinner startTimeSpinner "Start Time: " type:#float range:[1,100,1]
button create "Create Fireworks"
on create pressed do -- Event handler code start
(
numOfSpheres = count.value
sphereRadius = size.value
creationBoxSize = sPlane.value
maxHeight = maxHeightSpinner.value
startTime = startTimeSpinner.value
dropping = false
--create spheres
for i = 1 to numOfSpheres by 1 do
(
objs[i] = sphere radius:sphereRadius
local r = random 0 255
local g = random 0 255
local b = random 0 255
objs[i] .wirecolor = (color r g b)
objs[i] .pos = [random creationBoxSize -creationBoxSize, random creationBoxSize -creationBoxSize, 0] -- random possative and negative x/y values to create spawn box.
convertToMesh objs[i]
meshOp.explodeAllFaces objs[i] 0
)
)
) -- button ui code end
createDialog FireWorks width:200
此外,对我的评论和缩进的任何建议将不胜感激。(格式似乎在剪切和过去时被扔出窗外,我很抱歉我是这个论坛的新手。文件作为附件)
亲切的问候, ShineSmith :)
附加信息:
此外,这是我的导师给我的脚本,用于我的工作。
(此处需要对象数组,或单个对象的名称。其他人使用单个球体的 $name 及其实例来复制多个“烟花”)
convertToMesh $
meshop.explodeAllFaces $ 0
update $
v = 20
animate on
(
at time (sliderTime+50.000) ( meshop.bevelFaces $ #{1..$.numFaces} 0.0000001 0 )
at time (sliderTime+50.001) ( meshop.bevelFaces $ #{1..$.numFaces} 0.0000001 0 )
at time (sliderTime+100) ( meshop.bevelFaces $ #{1..$.numFaces} 100 0 )
at time (sliderTime) ( $.pos = $.pos )
for t = 5 to 100 by 5 do
(
v = v - 2
at time (sliderTime+t) ( $.pos = $.pos + [0,0,v] )
)
)