当前位置:网站首页>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边栏推荐
- Go language foundation ------17 ----- channel creation, read-write, security shutdown, multiplexing select
- Technical dry goods | Bert model for the migration of mindspore NLP model - text matching task (2): training and evaluation
- PAT甲级 1027 Colors in Mars
- [at] ABC 258g - triple Reach - violence
- Redis配置文件
- Technology dry goods | Roberta of the migration of mindspore NLP model - emotion analysis task
- PAT甲级 1028 List Sorting
- 【LeetCode】3. Merge Two Sorted Lists·合并两个有序链表
- 华为交换机配置ssh登录远程管理交换机
- PHP wechat red packet grabbing algorithm
猜你喜欢

The difference between hdmi2.1 and hdmi2.0 and the conversion of PD signals.

Docker installs MySQL and successfully uses Navicat connection

Project experience sharing: handwritten Chinese character recognition based on Shengsi mindspire

Go language foundation ----- 02 ----- basic data types and operators

Go language foundation ----- 15 ----- reflection

PAT甲级 1032 Sharing

璞华PLM为全场景产品生命周期管理赋能,助力产品主线的企业数字化转型

haproxy+keepalived搭建01

Pat class a 1031 Hello world for u

Go language foundation ----- 01 ----- go language features
随机推荐
Go language foundation ----- 01 ----- go language features
Huawei switch basic configuration (telnet/ssh login)
Wechat applet taro learning record
基于RNA的新型癌症疗法介绍
GoLang之结构体
RM delete file
Static keyword
PAT甲级 1032 Sharing
Redis batch startup and shutdown script
Go language foundation ----- 09 ----- exception handling (error, panic, recover)
Robots protocol
Go language foundation ------ 12 ------ JSON
一篇文章让你读懂-曼彻斯特编码
Go language foundation ----- 19 ----- context usage principle, interface, derived context (the multiplexing of select can be better understood here)
EtherCAT state machine transition (ESM)
Huawei switches are configured with SSH login remote management switches
OSPF protocol summary
多旅行商问题——公式和求解过程概述
什么是数据类型?数据类型有什么用?
Pat class a 1030 travel plan