本文整理汇总了C#中Transform.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Transform.Equals方法的具体用法?C# Transform.Equals怎么用?C# Transform.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform.Equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: inHits
bool inHits(Transform t)
{
foreach (RaycastHit hit in hits) {
if (t.Equals(hit.transform)) {
return true;
}
}
return false;
}
示例2: DisplayInstanceMesh
/// <summary>
/// Creates an instance of a DisplayMesh with a new transform.
/// </summary>
public DisplayInstanceMesh(DisplayMesh mesh, Transform xform)
{
Mesh = mesh;
IsVisible = mesh.IsVisible;
LayerIndex = mesh.LayerIndex;
m_xform = xform;
Transform zeroXForm = CreateZeroTransform ();
if (m_xform.Equals(zeroXForm))
m_xform = Transform.Identity;
}
示例3: ExplodeIntoArray
/// <summary>
/// Explodes a list of DisplayObjects into DisplayMeshes
/// </summary>
public new void ExplodeIntoArray(RMModel model, List<DisplayObject> array, Transform xform)
{
bool isIdentityXform = xform.Equals (Transform.Identity);
if (DisplayMeshes == null)
return;
foreach (DisplayMesh mesh in DisplayMeshes) {
if (isIdentityXform) {
mesh.IsVisible = Visible;
mesh.LayerIndex = LayerIndex;
array.Add (mesh);
} else {
DisplayInstanceMesh instanceMesh = new DisplayInstanceMesh (mesh, xform);
instanceMesh.IsVisible = Visible;
instanceMesh.LayerIndex = LayerIndex;
array.Add (instanceMesh);
}
}
}
示例4: BuildObjectOnSide
/*
//creates a square and puts it on the correct side (as determined by vector from the center of the cube)
GameObject BuildObjectOnSide(Transform localObject, Vector3 vector){
GameObject square = Instantiate(cubePrefab, localObject.transform.position, localObject.transform.rotation) as GameObject;
square.transform.parent = this.transform;
square.transform.localScale = localObject.localScale;
//moved the created object to the correct side
square = moveObjectToSide (localObject, vector, square);
return square;
}*/
// Update is called once per frame
void Update()
{
//send a ray from the center of the screen to the object
Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f));
RaycastHit hit = new RaycastHit();
//if the ray hits the object, then do stuff
if (Physics.Raycast(ray, out hit, maxPickingDistance))
{
//retrieve the object that was hit
pickedObject = hit.transform;
Vector3 pos = hit.point;
//place the cubeFinger at the correct location (or remove it if it shouldn t be seen)
if(pickedObject.Equals(cubeFinger.transform)){
//if the objects hits the cubeFinger, it is in the right place already.
//so don t do anything
}
else{
//if it hits a new block, move the blockfinger there
cubeFinger.SetActive(true);
moveObjectToSide(pickedObject, pos, cubeFinger);
}
//if a build action is given, place the block at the cubefinger location
if (Input.GetMouseButtonDown (0) && cubeFinger.activeInHierarchy) {
placeSquareAtFinger();
//disable cubefinger, so it is placed in it s shiny new good position on next update
cubeFinger.SetActive(false);
}
}
else
{
//if the trace did not hit anything, there is no sense in having a cubefinger enabled
cubeFinger.SetActive(false);
pickedObject = null;
}
}
示例5: findRandomTarget
public static Transform findRandomTarget(Transform myTeam)
{
Transform team = myTeam.Equals(teamEins) ? teamZwei : teamEins;
return team.GetChild(Random.Range(0, team.childCount));
}