本文整理汇总了C#中Plane类的典型用法代码示例。如果您正苦于以下问题:C# Plane类的具体用法?C# Plane怎么用?C# Plane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Plane类属于命名空间,在下文中一共展示了Plane类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetVanishingPoint
// =============================================================================
// METHODS STATIC --------------------------------------------------------------
public static void SetVanishingPoint( Camera cam, float offset, ClientCameraScreen screen )
{
Transform t = cam.transform;
NearPlane plane = new NearPlane();
Vector3 nearCenter = t.position + t.forward*cam.nearClipPlane;
Plane nearPlane = new Plane ( -t.forward, nearCenter );
float distance = 0f;
Vector3 direction;
Ray ray;
Vector3 screenTL = t.TransformPoint ( new Vector3 ( ( -screen.Width/2.0f ) + offset, screen.Height/2.0f, screen.Distance ) );
direction = ( screenTL - t.position ).normalized;
ray = new Ray ( t.position, direction );
nearPlane.Raycast ( ray, out distance );
Vector3 nearTL = -( t.InverseTransformPoint ( nearCenter ) - t.InverseTransformPoint ( ( t.position + direction*distance ) ) );
Vector3 screenBR = t.TransformPoint ( new Vector3 ( ( screen.Width/2.0f ) + offset, -screen.Height/2.0f, screen.Distance ) );
direction = ( screenBR - t.position ).normalized;
ray = new Ray ( t.position, direction );
nearPlane.Raycast ( ray, out distance );
Vector3 nearBR = -( t.InverseTransformPoint ( nearCenter ) - t.InverseTransformPoint ( ( t.position + direction*distance ) ) );
plane.left = nearTL.x;
plane.top = nearTL.y;
plane.right = nearBR.x;
plane.bottom = nearBR.y;
plane.near = cam.nearClipPlane;
plane.far = cam.farClipPlane;
cam.projectionMatrix = PerspectiveOffCenter ( plane );
}
开发者ID:Jonas90,项目名称:iss,代码行数:33,代码来源:ClientCameraVanishingPoint.cs
示例2: DoClick
private void DoClick(object sender, ClickedEventArgs e)
{
if (this.teleportOnClick)
{
float y = this.reference.position.y;
Plane plane = new Plane(Vector3.up, -y);
Ray ray = new Ray(base.transform.position, base.transform.forward);
bool flag = false;
float d = 0f;
if (this.teleportType == SteamVR_Teleporter.TeleportType.TeleportTypeUseCollider)
{
TerrainCollider component = Terrain.activeTerrain.GetComponent<TerrainCollider>();
RaycastHit raycastHit;
flag = component.Raycast(ray, out raycastHit, 1000f);
d = raycastHit.distance;
}
else if (this.teleportType == SteamVR_Teleporter.TeleportType.TeleportTypeUseCollider)
{
RaycastHit raycastHit2;
Physics.Raycast(ray, out raycastHit2);
d = raycastHit2.distance;
}
else
{
flag = plane.Raycast(ray, out d);
}
if (flag)
{
Vector3 position = ray.origin + ray.direction * d - new Vector3(this.reference.GetChild(0).localPosition.x, 0f, this.reference.GetChild(0).localPosition.z);
this.reference.position = position;
}
}
}
开发者ID:GameDiffs,项目名称:TheForest,代码行数:33,代码来源:SteamVR_Teleporter.cs
示例3: CreateThroughBox
/// <summary>
/// Extends a plane into a plane surface so that the latter goes through a bounding box.
/// </summary>
/// <param name="plane">An original plane value.</param>
/// <param name="box">A box to use for extension boundary.</param>
/// <returns>A new plane surface on success, or null on error.</returns>
/// <example>
/// <code source='examples\vbnet\ex_splitbrepwithplane.vb' lang='vbnet'/>
/// <code source='examples\cs\ex_splitbrepwithplane.cs' lang='cs'/>
/// <code source='examples\py\ex_splitbrepwithplane.py' lang='py'/>
/// </example>
public static PlaneSurface CreateThroughBox(Plane plane, BoundingBox box)
{
IntPtr ptr = UnsafeNativeMethods.RHC_RhinoPlaneThroughBox2(ref plane, ref box);
if (IntPtr.Zero == ptr)
return null;
return new PlaneSurface(ptr, null);
}
开发者ID:jackieyin2015,项目名称:rhinocommon,代码行数:18,代码来源:opennurbs_planesurface.cs
示例4: Update
void Update () {
// Movement input
Vector3 moveInput = new Vector3 (Input.GetAxisRaw ("Horizontal"), 0, Input.GetAxisRaw ("Vertical"));
Vector3 moveVelocity = moveInput.normalized * moveSpeed;
controller.Move (moveVelocity);
// Look input
Ray ray = viewCamera.ScreenPointToRay (Input.mousePosition);
Plane groundPlane = new Plane (Vector3.up, Vector3.up * gunController.GunHeight);
float rayDistance;
if (groundPlane.Raycast(ray,out rayDistance)) {
Vector3 point = ray.GetPoint(rayDistance);
//Debug.DrawLine(ray.origin,point,Color.red);
controller.LookAt(point);
crosshairs.transform.position = point;
crosshairs.DetectTargets(ray);
if ((new Vector2(point.x, point.z) - new Vector2(transform.position.x, transform.position.z)).sqrMagnitude > 1) {
gunController.Aim(point);
}
}
// Weapon input
if (Input.GetMouseButton(0)) {
gunController.OnTriggerHold();
}
if (Input.GetMouseButtonUp(0)) {
gunController.OnTriggerRelease();
}
if (Input.GetKeyDown (KeyCode.R)) {
gunController.Reload();
}
}
开发者ID:ardaWill,项目名称:Create-a-Game-Source,代码行数:33,代码来源:Player.cs
示例5: Update
void Update()
{
var plane = new Plane(Vector3.up, transform.position);
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
float hit;
if (plane.Raycast(ray, out hit))
{
var aimDirection = Vector3.Normalize(ray.GetPoint(hit) - transform.position);
var targetRotation = Quaternion.LookRotation(aimDirection);
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, 360 * Time.deltaTime);
if (Input.GetMouseButtonDown(0))
bulletPrefab.Spawn(gun.position, gun.rotation);
}
if (Input.GetKeyDown(KeyCode.Space))
{
bulletPrefab.DestroyPooled();
}
if (Input.GetKeyDown(KeyCode.Z))
{
bulletPrefab.DestroyAll();
}
}
开发者ID:vietha9119,项目名称:ZigZag,代码行数:25,代码来源:Turret.cs
示例6: BuildDecalForObject
public static void BuildDecalForObject(DecalGenerator generator, Transform decal, Transform affectedObject)
{
Mesh affectedMesh = affectedObject.GetComponent<MeshFilter>().sharedMesh;
if (affectedMesh == null) return;
float maxAngle = generator.maxAngle;
Plane right = new Plane(Vector3.right, Vector3.right / 2f);
Plane left = new Plane(-Vector3.right, -Vector3.right / 2f);
Plane top = new Plane(Vector3.up, Vector3.up / 2f);
Plane bottom = new Plane(-Vector3.up, -Vector3.up / 2f);
Plane front = new Plane(Vector3.forward, Vector3.forward / 2f);
Plane back = new Plane(-Vector3.forward, -Vector3.forward / 2f);
Vector3[] vertices = affectedMesh.vertices;
int[] triangles = affectedMesh.triangles;
int startVertexCount = bufVertices.Count;
Matrix4x4 matrix = decal.worldToLocalMatrix * affectedObject.transform.localToWorldMatrix;
for (int i = 0; i < triangles.Length; i += 3)
{
int i1 = triangles[i];
int i2 = triangles[i + 1];
int i3 = triangles[i + 2];
Vector3 v1 = matrix.MultiplyPoint(vertices[i1]);
Vector3 v2 = matrix.MultiplyPoint(vertices[i2]);
Vector3 v3 = matrix.MultiplyPoint(vertices[i3]);
Vector3 side1 = v2 - v1;
Vector3 side2 = v3 - v1;
Vector3 normal = Vector3.Cross(side1, side2).normalized;
if (Vector3.Angle(-Vector3.forward, normal) >= maxAngle) continue;
DecalPolygon poly = new DecalPolygon(v1, v2, v3);
poly = DecalPolygon.ClipPolygon(poly, right);
if (poly == null) continue;
poly = DecalPolygon.ClipPolygon(poly, left);
if (poly == null) continue;
poly = DecalPolygon.ClipPolygon(poly, top);
if (poly == null) continue;
poly = DecalPolygon.ClipPolygon(poly, bottom);
if (poly == null) continue;
poly = DecalPolygon.ClipPolygon(poly, front);
if (poly == null) continue;
poly = DecalPolygon.ClipPolygon(poly, back);
if (poly == null) continue;
AddPolygon(poly, normal);
}
GenerateTexCoords(startVertexCount, generator.sprite);
}
开发者ID:2dkott,项目名称:NSCom,代码行数:60,代码来源:DecalBuilder.cs
示例7: ProjectScreenPointOnDragPlane
// converts a screen-space position to a world-space position constrained to the current drag plane type
// returns false if it was unable to get a valid world-space position
public bool ProjectScreenPointOnDragPlane( Vector3 refPos, Vector2 screenPos, out Vector3 worldPos )
{
worldPos = refPos;
if( DragPlaneCollider )
{
Ray ray = RaycastCamera.ScreenPointToRay( screenPos );
RaycastHit hit;
if( !DragPlaneCollider.Raycast( ray, out hit, float.MaxValue ) )
return false;
worldPos = hit.point + DragPlaneOffset * hit.normal;
}
else // DragPlaneType.Camera
{
Transform camTransform = RaycastCamera.transform;
// create a plane passing through refPos and facing toward the camera
Plane plane = new Plane( -camTransform.forward, refPos );
Ray ray = RaycastCamera.ScreenPointToRay( screenPos );
float t = 0;
if( !plane.Raycast( ray, out t ) )
return false;
worldPos = ray.GetPoint( t );
}
return true;
}
开发者ID:AtwoodDeng,项目名称:GGJ2015,代码行数:34,代码来源:TBDragToMove.cs
示例8: TestPlaneConstructor
public static void TestPlaneConstructor()
{
PlaneAttributes atts = new PlaneAttributes("badger50", 1, 5, 3, 7, 2000);
Plane p = new Plane("acas-1200-badger50", atts);
//A plane should have anything assigned to it in the constructor reflected in it immediately.
p.attributes.maxHeight.ShouldBe(2000);
p.attributes.planeModelGUID.ShouldBe("badger50");
p.attributes.planeHeight.ShouldBe(3);
p.attributes.planeWidth.ShouldBe(5);
p.attributes.planeLength.ShouldBe(7);
p.attributes.planeClass.ShouldBe(1);
//A new plane should have no position data within it.
p.GetPositionCount().ShouldBe(0);
//A new plane with no position data should have a 'zero' velocity
p.IsClass(p.attributes.planeClass).ShouldBe(true);
Vector3d vel = p.GetVelocity();
vel.x.ShouldBe(0, .01);
vel.y.ShouldBe(0, .01);
vel.z.ShouldBe(0, .01);
//Getting position from a newly constructed plane (with no position data)
//should cause a NotSupportedException
Exception ex = null;
try {
Vector3d pos = p.GetPosition();
} catch (Exception e) {
ex = e;
}
ex.ShouldNotBeNull();
ex.GetType().ShouldBe(typeof(NotSupportedException));
}
开发者ID:2015SoftwarePrinciples,项目名称:GTKTestWindow,代码行数:34,代码来源:ObjectTests.cs
示例9: Caminar
void Caminar()
{
// Da seguimiento a la distancia entre este gameObject y posicionDestino.
distanciaDestino = Vector3.Distance(posicionDestino, esteTransform.position);
// Mueve al jugador si el click izquierdo del mouse fue clickeado.
if (Input.GetMouseButtonDown(0) && GUIUtility.hotControl == 0) {
Plane planoJugador = new Plane(Vector3.up, esteTransform.position);
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
//Debug.DrawRay(ray.origin, ray.direction * 10, Color.yellow);
float longitudRayo = 0.0f;
// Obtenemos la longitud del rayo.
if (planoJugador.Raycast(ray, out longitudRayo)) {
posicionDestino = ray.GetPoint(longitudRayo); // Coordenada destino
Quaternion rotacionDestino = Quaternion.LookRotation(posicionDestino - transform.position);
esteTransform.rotation = rotacionDestino;
}
}
// Evita que el codigo se ejecute si no es necesario.
if(distanciaDestino > .5f){
esteTransform.position = Vector3.MoveTowards(esteTransform.position, posicionDestino, velocidad * Time.deltaTime);
}
}
开发者ID:racsoraul,项目名称:COMPDES_2015,代码行数:26,代码来源:PersonajeArmaMovement.cs
示例10: AttachMirrorPlane
void AttachMirrorPlane(BabylonTexture babylonTexture, NovaObject novaObject)
{
// Mirror plane
int f1, f2, f3;
if (novaObject.Is32bits)
{
f1 = novaObject.Indices32[2];
f2 = novaObject.Indices32[1];
f3 = novaObject.Indices32[0];
}
else
{
f1 = novaObject.Indices[2];
f2 = novaObject.Indices[1];
f3 = novaObject.Indices[0];
}
Vector3 a = novaObject.PositionOnlyVertices[f1];
Vector3 b = novaObject.PositionOnlyVertices[f2];
Vector3 c = novaObject.PositionOnlyVertices[f3];
var mainPlane = new Plane(a, b, c);
Matrix matrix = Matrix.Invert(novaObject.WorldMatrix);
matrix = Matrix.Transpose(matrix);
Plane plane = Plane.Transform(mainPlane, matrix);
babylonTexture.mirrorPlane = new[] { plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.D };
}
开发者ID:CallmeNezha,项目名称:Babylon.js,代码行数:29,代码来源:NovaExporter.Materials.cs
示例11: MustFlipCurve
/// <summary>
/// Checks if curve is flipped to a plane.
/// </summary>
/// <param name="plane">
/// The plane.
/// </param>
/// <param name="curve">
/// The curve.
/// </param>
/// <returns>
/// True if the curve is flipped to the plane, false otherwise.
/// </returns>
public static bool MustFlipCurve(Plane plane, Curve curve)
{
XYZ xVector = null;
XYZ yVector = null;
if (curve is Arc)
{
Arc arc = curve as Arc;
xVector = arc.XDirection;
yVector = arc.YDirection;
}
else if (curve is Ellipse)
{
Ellipse ellipse = curve as Ellipse;
xVector = ellipse.XDirection;
yVector = ellipse.YDirection;
}
else
return false;
List<double> realListX = ConvertVectorToLocalCoordinates(plane, xVector);
List<double> realListY = ConvertVectorToLocalCoordinates(plane, yVector);
double dot = realListY[0] * (-realListX[1]) + realListY[1] * (realListX[0]);
if (dot < -MathUtil.Eps())
return true;
return false;
}
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:40,代码来源:GeometryUtil.cs
示例12: Update
void Update()
{
// Movement Input
Vector3 moveInput = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
Vector3 moveVelocity = moveInput.normalized * moveSpeed;
pc.Move(moveVelocity);
// Look/Aim Input
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
Plane groundPlane = new Plane(Vector3.up, Vector3.zero);
float rayDist;
if(groundPlane.Raycast(ray, out rayDist))
{
Vector3 point = ray.GetPoint(rayDist);
Debug.DrawLine(ray.origin, point, Color.red);
pc.LookAt(point);
}
// Shooting Input
if(Input.GetMouseButton(0))
{
gc.Shoot();
}
}
开发者ID:gholaday,项目名称:Project-Arena,代码行数:27,代码来源:Player.cs
示例13: Frustum
public Frustum()
{
for (var planeIndex = 0; planeIndex < _planes.Length; planeIndex++)
{
_planes[planeIndex] = new Plane();
}
}
开发者ID:baldercollaborator,项目名称:Balder,代码行数:7,代码来源:Frustum.cs
示例14: OnMouseMove
public void OnMouseMove( dfControl control, dfMouseEventArgs args )
{
if( animating || !dragging )
return;
this.momentum = ( momentum + args.MoveDelta.Scale( 1, -1 ) ) * 0.5f;
args.Use();
if( args.Buttons.IsSet( dfMouseButtons.Left ) )
{
var ray = args.Ray;
var distance = 0f;
var direction = Camera.main.transform.TransformDirection( Vector3.back );
var plane = new Plane( direction, lastPosition );
plane.Raycast( ray, out distance );
var pos = ( ray.origin + ray.direction * distance ).Quantize( control.PixelsToUnits() );
var offset = pos - lastPosition;
var transformPos = ( control.transform.position + offset ).Quantize( control.PixelsToUnits() );
control.transform.position = transformPos;
lastPosition = pos;
}
}
开发者ID:dashqasar,项目名称:GoogleMap,代码行数:28,代码来源:TouchThrow.cs
示例15: RobotCellUR
internal RobotCellUR(string name, RobotArm robot, IO io, Plane basePlane, Mesh environment) : base(name, Manufacturers.UR, io, basePlane, environment)
{
this.Robot = robot as RobotUR;
this.DisplayMesh = new Mesh();
DisplayMesh.Append(robot.DisplayMesh);
this.DisplayMesh.Transform(this.BasePlane.ToTransform());
}
开发者ID:visose,项目名称:Robots,代码行数:7,代码来源:RobotCellUR.cs
示例16: DragObject
IEnumerator DragObject(float distance)
{
var oldDrag = springJoint.connectedBody.drag;
var oldAngularDrag = springJoint.connectedBody.angularDrag;
springJoint.connectedBody.drag = drag;
springJoint.connectedBody.angularDrag = angularDrag;
var mainCamera = FindCamera();
while (Input.GetMouseButton (0))
{
Plane plane = new Plane(Vector3.back, constraintPlaneObject.transform.position);
Ray ray = mainCamera.ScreenPointToRay (Input.mousePosition);
float constraintPlaneDistance = 0.0f;
plane.Raycast(ray, out constraintPlaneDistance);
springJoint.transform.position = ray.GetPoint(constraintPlaneDistance);
line.SetPosition(0, springJoint.transform.TransformPoint(springJoint.anchor));
line.SetPosition(1, springJoint.transform.position);
yield return null;
}
if (springJoint.connectedBody)
{
springJoint.connectedBody.drag = oldDrag;
springJoint.connectedBody.angularDrag = oldAngularDrag;
springJoint.connectedBody.freezeRotation = false;
//springJoint.connectedBody = null;
Destroy(go);
}
}
开发者ID:ZelimDamian,项目名称:Chem,代码行数:29,代码来源:ConstrainedDrag.cs
示例17: getMouseWorldPosition
/// <summary>
/// Checks the mouse's position set in the in-game world plane.
/// </summary>
/// <param name="mousePosition">Mouse's position on screen</param>
/// <param name="camera">Camera object</param>
/// <param name="device">Graphics device used in rendering</param>
/// <returns></returns>
public static Vector3 getMouseWorldPosition(Vector2 mousePosition,CameraAndLights camera,GraphicsDevice device)
{
Vector3 nearsource = new Vector3(mousePosition,0f);
Vector3 farsource = new Vector3(mousePosition,CameraAndLights.nearClip);
Vector3 nearPoint = device.Viewport.Unproject(nearsource,
camera.projectionMatrix,
camera.viewMatrix,
Matrix.Identity);
Vector3 farPoint = device.Viewport.Unproject(farsource,
camera.projectionMatrix,
camera.viewMatrix,
Matrix.Identity);
// Create a ray from the near clip plane to the far clip plane.
Vector3 direction = farPoint - nearPoint;
direction.Normalize();
Ray pickRay = new Ray(nearPoint,direction);
Plane floor = new Plane(new Vector3(0f,1f,0f),0f);
float denominator = Vector3.Dot(floor.Normal,pickRay.Direction);
float numerator = Vector3.Dot(floor.Normal,pickRay.Position) + floor.D;
float dist = -(numerator / denominator);
Vector3 mouseWorldPos = nearPoint + direction * dist;
return mouseWorldPos * new Vector3(1f,0f,1f);
}
开发者ID:ArghyV,项目名称:Peliohjelmointi-s2011,代码行数:37,代码来源:Input.cs
示例18: Update
// Update is called once per frame
void Update()
{
Plane targetPlane = new Plane(transform.up, transform.position);
foreach (Touch touch in Input.touches) {
anim.SetBool("isWalking",true);
//Gets the ray at position where the screen is touched
Ray ray = Camera.main.ScreenPointToRay(touch.position);
//Gets the position of ray along plane
float dist = 0.0f;
//Intersects ray with the plane. Sets dist to distance along the ray where intersects
targetPlane.Raycast(ray, out dist);
//Returns point dist along the ray.
Vector3 planePoint = ray.GetPoint(dist);
//Debug.Log("Point=" + planePoint);
//True if finger touch began. If ray intersects collider, set pickedObject to transform
//of collider object
if (touch.phase == TouchPhase.Began || touch.phase == TouchPhase.Stationary) {
//anim.SetBool("isWalking",true);
player.transform.LookAt(planePoint);
player.transform.localPosition = Vector3.MoveTowards(playerPos, planePoint, 0.5F * Time.deltaTime);
//playerPos = player.transform.position;
playerPos = player.transform.localPosition;
} else if (touch.phase == TouchPhase.Ended){
anim.SetBool("isWalking",false);
}
}
}
开发者ID:nuttonutto,项目名称:Demo,代码行数:28,代码来源:clickedMove.cs
示例19: SetPrintLevelingEquation
public void SetPrintLevelingEquation(Vector3 position0, Vector3 position1, Vector3 position2, Vector2 bedCenter)
{
if (position0 == position1 || position1 == position2 || position2 == position0)
{
return;
}
Plane planeOfPoints = new Plane(position0, position1, position2);
Ray ray = new Ray(new Vector3(bedCenter, 0), Vector3.UnitZ);
bool inFront;
double distanceToPlaneAtBedCenter = planeOfPoints.GetDistanceToIntersection(ray, out inFront);
Matrix4X4 makePointsFlatMatrix = Matrix4X4.CreateTranslation(-bedCenter.x, -bedCenter.y, -distanceToPlaneAtBedCenter);
makePointsFlatMatrix *= Matrix4X4.CreateRotation(planeOfPoints.planeNormal, Vector3.UnitZ);
makePointsFlatMatrix *= Matrix4X4.CreateTranslation(bedCenter.x, bedCenter.y, 0);//distanceToPlaneAtBedCenter);
bedLevelMatrix = Matrix4X4.Invert(makePointsFlatMatrix);
{
// test that the points come back as 0 zs
Vector3 outPosition0 = Vector3.TransformPosition(position0, makePointsFlatMatrix);
Vector3 outPosition1 = Vector3.TransformPosition(position1, makePointsFlatMatrix);
Vector3 outPosition2 = Vector3.TransformPosition(position2, makePointsFlatMatrix);
Vector3 printPosition0 = new Vector3(ActiveSliceSettings.Instance.GetPrintLevelSamplePosition(0), 0);
Vector3 printPosition1 = new Vector3(ActiveSliceSettings.Instance.GetPrintLevelSamplePosition(1), 0);
Vector3 printPosition2 = new Vector3(ActiveSliceSettings.Instance.GetPrintLevelSamplePosition(2), 0);
Vector3 leveledPositon0 = Vector3.TransformPosition(printPosition0, bedLevelMatrix);
Vector3 leveledPositon1 = Vector3.TransformPosition(printPosition1, bedLevelMatrix);
Vector3 leveledPositon2 = Vector3.TransformPosition(printPosition2, bedLevelMatrix);
}
}
开发者ID:rubenkar,项目名称:MatterControl,代码行数:34,代码来源:PrintLeveling.cs
示例20: Internal_RaycastRef
internal bool Internal_RaycastRef(Ray ray, ref UIHotSpot.Hit hit)
{
float single;
Vector2 vector2 = new Vector2();
if (this.radius == 0f)
{
return false;
}
Plane plane = new Plane(UIHotSpot.forward, this.center);
if (!plane.Raycast(ray, out single))
{
hit = new UIHotSpot.Hit();
return false;
}
hit.point = ray.GetPoint(single);
hit.normal = (!plane.GetSide(ray.origin) ? UIHotSpot.backward : UIHotSpot.forward);
vector2.x = hit.point.x - this.center.x;
vector2.y = hit.point.y - this.center.y;
float single1 = vector2.x * vector2.x + vector2.y * vector2.y;
if (single1 >= this.radius * this.radius)
{
return false;
}
hit.distance = Mathf.Sqrt(single1);
return true;
}
开发者ID:HexHash,项目名称:LegacyRust,代码行数:26,代码来源:UICircleHotSpot.cs
注:本文中的Plane类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论