5.7 - Simple Car Example Using Functions
来源:互联网 发布:服装商品数据分析指标 编辑:程序博客网 时间:2024/05/18 03:54
import maya.cmds as cmdsdef create_car(name, length =2 , width = 1): body = create_body(length, width) tires = create_tires(length, width) final_name = assemble_car(name, body, tires) cmds.select(clear=True) return final_name def create_body(length, width): body = cmds.polyPlane( w = length, h = width, name = "body") return body[0] # transform node def create_tires(body_length, body_width): tire_width = 0.25 * body_width tire_radius = 0.25 * body_length x_pos = 0.5 * body_length z_pos = 0.5 * body_width + 0.5 * tire_width fl_tire = create_tire("front_left_tire", tire_width, tire_radius, x_pos, 0, -z_pos) fr_tire = create_tire("front_right_tire", tire_width, tire_radius, x_pos, 0, z_pos) rl_tire = create_tire("rear_left_tire", tire_width, tire_radius, -x_pos, 0, -z_pos) rr_tire = create_tire("rear_right_tire", tire_width, tire_radius, -x_pos, 0, z_pos) return [fl_tire, fr_tire, rl_tire, rr_tire] def create_tire(name, width, radius, tx, ty, tz): tire = cmds.polyCylinder(h = width, r = radius, ax = (0, 0, 1), sc = True, name = name) cmds.setAttr("{0}.translate".format(tire[0]), tx, ty, tz) return tire[0] def assemble_car(name, body, tires): body_grp = cmds.group(body, name = "body_grp") tires_grp = cmds.group(tires, name = "tires_grp") car_grp = cmds.group(body_grp, tires_grp, name = name) return car_grp if __name__ == "__main__": final_name = create_car("test_car") print(" Car created: {0}".format(final_name))
0 0
- 5.7 - Simple Car Example Using Functions
- Simple example for using thousand separator
- Simple Example using the C++ Analyzer with Rose RealTime
- A Simple Example of Dynamic Programming using perl scripts
- Simple example of using the Java Native Interface(JNI)
- Dead simple example of using Multiprocessing Queue, Pool and Locking
- neo4j: A simple example using the JDBC driver
- Go by Example: Functions
- My simple functions
- Simple String Compression Functions
- A simple Example of using Video Textures in Managed DirectX (C#)
- AOP Simple example
- Log4j simple example
- Simple Lucene Example Code
- a simple ajax example
- A simple wxPython example
- Simple snoopy example
- A simple DirectShow example
- python之自动生成图像列表
- Git入门及上传项目到github中
- 第22篇 js中的this指针的用法
- kali安装pip包遇到问题以及解决方法
- 南昌大学软件学院21天大神养成计划_第三天学习心得体会
- 5.7 - Simple Car Example Using Functions
- 基于Smack3.0.4+ Openfire3.10.2开发之Android 客户端之二
- 开发总结
- OC学习篇之---类的三大特性(封装,继承,多态)
- 艺术品定制网站-开发服务器环境搭建のtomcat
- LeetCode 之 Add Digits
- HTTP协议下Android web应用GET和POST请求方法的请求、响应、传参
- java中的栈 Staack
- 如何安装windows和linux双系统