首页 技术 正文
技术 2022年11月15日
0 收藏 580 点赞 3,744 浏览 5004 个字

Primitive and Placeholder Objects

原始的基础物体

Unity can work with 3D models of any shape that can be created with modelling software. However,

there are also a number of primitive object types that can be created directly within Unity, namely the

Cube, Sphere, Capsule, Cylinder, Plane and Quad. These objects are often useful in their own right

(a plane is commonly used as a flat ground surface, for example) but they also offer a quick way to

create placeholders and prototypes for testing purposes. Any of the primitives can be added to the

scene using the appropriate item on the GameObject > 3D Object menu.

Unity能够操作3D建模软件创造的随意形状的3D模型。同一时候unity也有很多自带的能够直接生成的原始物体。比如方块,球体。胶囊体。圆柱体,平面和四边形。

这些物体自身通常都非常有用(举例来说,平面就经常被用来做成扁平的地表),可是在一些測试目的中它们也能够提供高速改变位置和类型的方法。全部这些物体都能够被作为合适的物体来加入到游戏场景中,通过菜单GameObject > 3D Object。

Cube

立方体

This is a simple cube with sides one unit long, textured so that the image is repeated on each of the

six faces. As it stands, a cube isn’t really a very common object in most games but when scaled, it

is very useful for walls, posts, boxes, steps and other similar items. It is also a handy placeholder

object for programmers to use during development when a finished model is not yet available. For

example, a car body can be crudely modelled using an elongated box of roughly the right dimensions.

Although this is not suitable for the finished game, it is fine as a simple representative object for

testing the car’s control code. Since a cube’s edges are one unit in length, you can check the

proportions of a mesh imported into the scene by adding a cube close by and comparing the sizes.

的简单立方体,假设给他进行贴图操作的话,图像会反复出如今每个面上。一个标准的立方体在很多游戏中并非会常常使用。可是仅仅要改变它的大小规模,他就能够变成墙壁、哨岗、箱子,台阶和其它类似的物体。当成品模型还没制作出来时,它也是程序猿在开发时的一个便捷的替代品。

举个样例。一辆汽车就能够用大致相似的尺度的瘦长的立方体盒子取代。

虽然这不适合游戏成品,可是作为測试车辆控制代码的取代牌就非常合适了。

既然标准立方体的边长是一单位长度,那么你也能够加入立方体到场景中去,用它来检验导入场景的网格的比例是否正确通过拿立方体的边长去靠近并比較。

Sphere

球体

This is a sphere of unit diameter (ie, 0.5 unit radius), textured so that the entire image wraps around

once with the top and bottom “pinched” at the poles. Spheres are obviously useful for representing balls

, planets and projectiles but a semi-transparent sphere can also make a nice GUI device for representing

the radius of an effect.

这是一个单位直径的球体(0.5单位半径),假设贴图的话。整个图像会根据上下两个极点压缩包裹整个球体。

球体的一些明显的用途代表是各种球。行星。炮弹。可是半透明的球体也能够制作非常美丽的GUI设备,根据调整半径达到这样的效果。

Capsule

胶囊体

A capsule is a cylinder with hemispherical caps at the ends. The object is one unit in diameter and two

units high (the body is one unit and the two caps are half a unit each). It is textured so that the image

wraps around exactly once, pinched at each hemisphere’s apex. While there aren’t many real world

objects with this shape, the capsule is a useful placeholder for prototyping. In particular, the physics

of a rounded object are sometimes better than those of a box for certain tasks.

一个胶囊体是一个柱体和上下两个半球体的组合。整个物体的规模是直径为一单位长度。高度为两单位长度(中间的柱体的高是一单位长度。两个半球是半径为0.5单位长度)。当它被贴图时,图像会根据上下两个半球的尖端,收缩包裹整个胶囊体。然而现实中这类形状的物体并不多见。可是胶囊体却是一个非常有用的占位原型。

特别是,对一些详细的工作来说,在物理效果表现上使用了胶囊体的丰满物体要比立方体要好非常多。

Cylinder

柱体

This is a simple cylinder which is two units high and one unit in diameter, textured so that the image

wraps once around the tube shape of the body but also appears separately in the two flat, circular ends.

Cylinders are very handy for creating posts, rods and wheels but you should note that the shape of the

collider is actually a capsule (there is no primitive cylinder collider in Unity). You should create a mesh

of the appropriate shape in a modelling program and attach a mesh collider if you need an accurate

cylindrical collider for physics purposes.

高为2的简单柱体,贴图的话图片会包裹着柱体的表面,包含上下两个底面此时贴图渲染结束。

柱体创建岗哨,棒条体,轮子这类物体十分方便,可是你须要注意,碰撞机的形状要选择胶囊体(unity的碰撞机里并没有柱体形状的碰撞机)。

假设你想要为了一些物理实验目的须要准确的柱体碰撞机,你须要在建模程序中创建一个合适形状的网格,并把它导入到网格碰撞机中去。

Plane

平面

This is a flat square with edges ten units long oriented in the XZ plane of the local coordinate space.

It is textured so that the whole image appears exactly once within the square. A plane is useful for

most kinds of flat surface, such as floors and walls. A surface is also needed sometimes for showing

images or movies in GUI and special effects. Although a plane can be used for things like this, the

simpler quad primitive is often a more natural fit to the task.

的仅仅能在局部坐标空间XZ平面调整的扁平正方形。假设被贴图那么整张图片都会出如今这个正方形上。

平面对非常多类型的扁平表面比方说地板墙壁都非常有用。一个处在GUI中的表面在某些时候还须要展示一些图片和影片等特殊效果、虽然一个平面能够这么用,可是另外一个原生物体四边形在这些问题上更适合。

Quad

四边形

The quad primitive resembles the plane but its edges are only one unit long and the surface is oriented

in the XY plane of the local coordinate space. Also, a quad is divided into just two triangles whereas the

plane contains two hundred. A quad is useful in cases where a scene object must be used simply as

a display screen for an image or movie. Simple GUI and information displays can be implemented with

quads, as can particles, sprites and “impostor” images that substitute for

这个原生四边形非常类似于上面提到的平面,可是四边形的边长仅仅有一单位长度,而且表面仅仅能在局部坐标系的XY平面调整。当然一个四边形仅仅能够被分成两个三角形,可是一个平面能够被分成两百个三角形。

当一个物体必需要展示图片和视频时,那么四边形就非常合适了。简单的GUI和信息展示都能够用四边形展示实现,当然还有粒子、精灵图片、伪图片也是能够的。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,082
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,556
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,406
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,179
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,815
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,898