当前位置:网站首页>Viz artist advanced script video tutorial -- stringmap use and vertex operation
Viz artist advanced script video tutorial -- stringmap use and vertex operation
2022-07-03 07:54:00 【hjm2046】
The ultimate effect of our video tutorial today is like this
What you see is a small one loops In a big circle Bumping around , Pass your own color to the one you hit circle .
Scripts mainly involve : Angular mirroring , Vector and StringMap
1. Angle mirror and vector , These two are mainly used to calculate small loops The direction of movement , Calculate the opposite path when you hit something , Otherwise, keep the previous direction of travel .
2. StringMap, It is mainly used to store each small loops The direction of movement , With each container Of ID As Key.
Artist About... In the script document StringMap Introduction to :
stringMap The simple usage is as follows :
dim dir_Map as stringMap ' Statement stringmap
dir_map["001"]="DAVID" ' assignment
dim name=(String)dir_map["001"] ’ Value
Excuse me , Take a video tutorial :height="498" width="510" src="http://player.youku.com/embed/XMTQ1MTM4ODUwMA==" frameborder="0" allowfullscreen="">
Youku's video quality is not good , You can go Vimeo watch Clearer video : Click to open the link
Download the scene in the video via file , Please take a look at the QR code of the avatar in the video or on the left of this article , Pay attention to my micro signal , send out SM*(* No. is replaced by the red appearing in this article circle The number of words , Be careful if you are not good at math ) Get the scene download address , Math is not good Or students who like to read the code directly , So please see :
dim ori,hitc as StringMap
dim ring_c as container=scene.findcontainer("Ring")
sub OnExecPerField()
dim dot_c as container=childcontainer
do while dot_c<> null
if not dot_c.active then exit do
dim c_id as string=(string)dot_c.vizid
if not ori.ContainsKey(c_id) then ori[c_id]=cvertex(2.0,1.0,0.0)
dim hit=hitc[c_id]
dim dir = (vertex)ori[c_id]
dim dot_c_pos,ring_c_pos as vertex
dot_c_pos=dot_c.position.xyz
dot_c_pos+=dir
dot_c_pos.z=0
dim dot_c_radius=dot_c.scaling.x*50.0
ring_c_pos=ring_c.position.xyz
if distance(ring_c_pos,dot_c_pos)>140-dot_c_radius then
dir=-dir.MirrorAroundVector(ring_c_pos-dot_c_pos)
hitc[c_id]=ring_c
ring_c.material=dot_c.material
end if
dim tc as container=scene.findcontainer("CIRCLE").childcontainer
do while tc<> null
if not tc.active then exit do
dim tc_radius = tc.scaling.x*50
dim tc_position= tc.position.xyz
if distance(tc_position,dot_c_pos)<tc_radius+dot_c_radius and tc<>hit then
dir=-dir.MirrorAroundVector(tc_position-dot_c_pos)
hitc[c_id]=tc
tc.material=dot_c.material
end if
tc=tc.nextcontainer
loop
dir.z=0.0
dir.Normalize()
dir *=2.5
ori[c_id]=dir
dot_c.position.xyz=dot_c_pos
dot_c=dot_c.nextcontainer
loop
end sub
边栏推荐
- STM32F103 SPI (pit Diary)
- GoLang之结构体
- [MySQL 13] if you change your password for the first time after installing mysql, you can skip MySQL password verification to log in
- 【LeetCode】3. Merge two sorted lists · merge two ordered linked lists
- Oracle queries grouped by time
- How to configure GDAL under idea
- Microsoft Security Response Center
- When did you find out that youth was over
- yarn link 是如何帮助开发者对 NPM 包进行 debug 的?
- Pat class a 1030 travel plan
猜你喜欢
EtherCAT state machine transition (ESM)
Go language foundation ----- 07 ----- method
*p++、*++p、++*p、(*p)++
Wechat applet taro learning record
PAT甲级 1029 Median
Go language foundation ----- 04 ----- closure, array slice, map, package
WorldView卫星遥感影像数据/米级分辨率遥感影像
一篇文章让你读懂-曼彻斯特编码
Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does
创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
随机推荐
Pat grade a 1027 colors in Mars
PostGIS space function
register关键字
jsutlis
PHP common sorting algorithm
GoLang之结构体
研究显示乳腺癌细胞更容易在患者睡觉时进入血液
Huawei switch console password reset, device initialization, default password
C language learning notes (mind map)
PAT甲级 1028 List Sorting
Structure of golang
Go language foundation ----- 07 ----- method
Go language foundation ----- 16 ----- goroutine, GPM model
How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
Redis batch startup and shutdown script
Unity XR realizes interaction (grasping, moving, rotating, transmitting, shooting) -pico
【踩坑系列】mysql 修改root密码失败
PHP常用排序算法
Technical dry goods | Bert model for the migration of mindspore NLP model - text matching task (2): training and evaluation
优质博客——