本文整理汇总了C#中Ray.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Ray.ToString方法的具体用法?C# Ray.ToString怎么用?C# Ray.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ray
的用法示例。
在下文中一共展示了Ray.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
// Update is called once per frame
void Update()
{
if( Input.GetMouseButtonDown(0) )
{
ray = Camera.main.ScreenPointToRay( Input.mousePosition );
Debug.Log ( ray.ToString() );
if (!Physics.Raycast( ray, out hit))
{
return;
}
}
velocity = hit.point - this.transform.position;
distance = velocity.magnitude;
rotation.SetLookRotation(velocity);
//velocity = transform.TransformDirection(velocity);
//velocity *= speed;
if ( distance > 10 )
{
_controller.transform.rotation = Quaternion.Slerp(this.transform.rotation, rotation, rot_speed * Time.deltaTime);
transform.Translate(Vector3.forward * speed * Time.deltaTime);
//_controller.Move( velocity.normalized * speed * Time.deltaTime);
}
}
示例2: Update
void Update ()
{
if (Input.GetKey (KeyCode.Mouse0)) {
//-----------debug------------------------------------------------------------------------------
Origin_start = Shoot.transmitOrigin;
Origin.text = Origin_start.ToString ();
//print (Shoot.transmitDistance);
//print (" x=" + Shoot.transmitRayX);
//print (Shoot.transmitRayY);
//print (Shoot.transmitRayZ);
//------------Bullet GUI -----------------------------------------------------------------------
range_hit = Shoot.transmitDistance;
Range.text = range_hit.ToString ();
//Bullet_X = Shoot.transmitRayX;
//info_X.text = Bullet_X.ToString ();
//Bullet_X = Shoot.valTourelleX;
//info_X.text = Bullet_X.ToString ();
Shoot.valTourelleX = float.Parse (info_X.text);
Shoot.valTourelleY = float.Parse (info_Y.text);
//Bullet_Y = Shoot.transmitRayY;
//info_Y.text = Bullet_Y.ToString ();
Bullet_X = Shoot.transmitRayX;
Bullet_Y = Shoot.transmitRayY;
info_Z.text = "Y:" + Bullet_Y.ToString () + " X:" + Bullet_X.ToString () ;
}
}
示例3: CanConvertToStringAndBack
public void CanConvertToStringAndBack()
{
var ray = new Ray(Vector3D.UnitX, Vector3D.UnitY);
var stringRay = ray.ToString();
Assert.AreEqual("Ray({1, 0, 0},{0, 1, 0})", stringRay);
var retrievedRay = new Ray(stringRay);
Assert.AreEqual(ray.Origin, retrievedRay.Origin);
Assert.AreEqual(ray.Direction, retrievedRay.Direction);
}