纳金网

标题: Shatter Toolkit Readme翻译(转载) [打印本页]

作者: 王者再临    时间: 2014-7-26 17:09
标题: Shatter Toolkit Readme翻译(转载)
Shatter Toolkit插件,自己正在熟悉,同时方便别人使用,现简单翻译下。

# Shatter Toolkit
# Copyright 2011 Gustav Olsson
# http://gustavolsson.squarespace.com/

# How it works

Attach one ShatterTool script instance and one UvMapper script instance (WorldUvMapper or TargetUvMapper), located in Core/Main/, to a game object that you want to shatter or split. When shattering or splitting a game object the pieces will be instantiated as clones of the original game object and the original game object will be destroyed.
要打碎或切割的游戏对象,需要绑定一个ShatterTool脚本和一个UvMapper脚本,这两个脚本在Core/Main中.当打碎或者切割一个游戏对象时,碎片会被创建,就像从源对象上克隆,而源对象会被销毁。

The ShatterTool script requires that the game object has a MeshFilter attached, as it needs some geometry to work with. Any other component you attach will be carried over without modification to the pieces when the game object is shattered or split. However, the ShatterTool script takes special care to itself, MeshCollider and Rigidbody components respectively. If attached, any of these will be updated to act realistically when the game object is shattered or split by for example modifying the Rigidbody's mass and velocity.
ShatterTool脚本需要游戏对象有一个MeshFilter的组件,因为它需要处理的就是几何体。该游戏对象上的其他任何组件,新的碎片模型也都会有。ShatterTool脚本还可以很好地处理MeshCollider和Rigidbody组件。当游戏对象被打碎和切割时候,所有的附加的组件都会更新,比如Rigidbody组件的质量和速度。

IMPORTANT! If you attach a MeshCollider and a Rigidbody, always keep the MeshCollider Convex in order to avoid errors while updating the mass properties of the Rigidbody.
重要!如果你附加了一个MeshCollider和Rigidbody组件,要保证选中MeshCollider的Convex属性,以避免更新Rigidbody组件的质量属性时所导致的错误。

IMPORTANT! If ShatterTool.FillCut is enabled (default) every edge of the mesh needs to belong to exactly two triangles, ie. the mesh needs to be closed.
重要!如果ShatterTool.FillCut是可用的(默认),网格(mesh)的每个边都要恰好属于两个三角形。网格需要是闭合的。

Here are a number of ways you can shatter or split a game object:
下面是打碎或者切割一个游戏对象的多种方式:
No scripting required:
无需脚本:

- Attach the ShatterOnCollision script (located in Helpers/Game Objects) and specify the required force needed to shatter the game object (requires an attached rigidbody and convex collider)
- 绑定ShatterOnCollision脚本(在Helpers/Game Objects)并且指定打碎游戏对象所需的力量(需要一个Rigidbody组件和一个勾选了Convex属性的Collider组件)
- Attach any of the mouse scripts (located in Helpers/Mouse) to an empty game object in the same scene
- 绑定任何一个鼠标脚本(在Helpers/Mouse)到该场景的一个空游戏对象上

Scripting:
需要脚本:
- In a script, send a "Shatter" message to the game object and specify a world-space point (Vector3) where the game object should be shattered; for example
SendMessage("Shatter", Vector3.zero);
- 在脚本中,给游戏对象发送“Shatter”消息,并指定一个世界坐标系中的点(Vector3),该点说明这个游戏对象应该在哪被打碎;例如
SendMessage("Shatter", Vector3.zero);

- In a script, send a "Split" message to the game object and specify an array of world-space planes (Plane[]) with unit-length normals where the game object should be split; for example
SendMessage("Split", new Plane[] { new Plane(Vector3.right, Vector3.zero) });
- 在一个脚本中,给游戏对象发送"Split"消息,并指定一组世界坐标系中的平面(Plane[]),平面需要指定单位向量用来说明该游戏对象应该从哪被分割。例如:
SendMessage("Split", new Plane[] { new Plane(Vector3.right, Vector3.zero) });

# Example scenes:

Check out the example scenes to see how the shatter toolkit is used in practice.
示例场景:
查看示例场景,看看Shatter插件如何应用。

# Good to know
知之有益
1. The ShatterTool properties have tooltips in the editor, mouse over to read them
1、ShatterTool属性编辑器中有提示,鼠标悬停可以显示。

2. Check out the Reference.zip for scripting reference
2、查看Reference.zip中的脚本参考

3. You can make the ShatterTool instance send pre- and post-split messages by toggling the "Pre Split msg" and the "Post Split msg" properties in the editor. These may be useful if you need to do something before and/or after a split occurs.
3、你可以通过切换编辑器上的"Pre Split msg" 和"Post Split msg"属性,使ShatterTool实例发送pre-和post-split消息。在你想在切割前或者切割后做某些操作,这些会很方便。

4. When shattering or splitting parented game objects, make sure you always handle the children/parent carefully to avoid duplicating too many game objects. See the Table game object in the Basic scene for an example.
4、当打碎或者切割有父子关系的对象时,要确保你总是谨慎地处理父子关系,以避免产生太多的游戏对象。示例参考Basic场景中的桌子对象。


作者: hyui    时间: 2014-7-26 19:14
Good article !
作者: nobodyland    时间: 2014-7-28 09:36
不错, 多谢分享




欢迎光临 纳金网 (http://rs.narkii.com/club/) Powered by Discuz! X2.5