public static TunnelVector3 operator -(TunnelVector3 vector1, TunnelVector3 vector2) { TunnelVector3 newVector = new TunnelVector3(); newVector.PositionVector = vector1.PositionVector - vector2.PositionVector; return(newVector); }
public PositionRotation GetPositionRotation(TunnelDetail detail, TunnelVector3 localPosition) { PositionRotation cutPositionRotation = detail.TunnelDetailCut.GetLocalPositionRotation(localPosition); PositionRotation curvePositionRotation = GetCentralPoint(detail, localPosition.Depth); return(curvePositionRotation + cutPositionRotation); }
public PositionRotation GetLocalPositionRotation(TunnelVector3 vector) { Quaternion rotation = Quaternion.Euler(vector.AngleDegrees.Value, 0, 0); return(new PositionRotation() { Position = rotation * (Vector3.down * (_radius - vector.Height)), Rotation = rotation }); }
public void PutInTunnel(Transform transform, TunnelVector3 globalPosition) { float localDepth; TunnelDetail detail = _detailMap.GetDetail(globalPosition.Depth, out localDepth); globalPosition.Depth = localDepth; PositionRotation position = _positionRotationCalculator.GetPositionRotation(detail, globalPosition); position.SetPosition(transform); }
public override bool Equals(object obj) { if (obj is TunnelVector3) { TunnelVector3 compare = (TunnelVector3)obj; return(compare.AngleDegrees == AngleDegrees && compare.Height == Height); } else if (obj is TunnelVector2) { TunnelVector2 compare = (TunnelVector2)obj; return(compare.AngleDegrees == AngleDegrees && compare.Height == Height); } return(base.Equals(obj)); }
private void SetPosition(TunnelVector3 position) { if (!IsInTunnel) { Debug.LogError("Tunnel is not assinged!"); return; } if (position.Depth < 0) { position.Depth = 0; } if (position.Depth > _tunnel.Length) { position.Depth = _tunnel.Length; } _position = position; _tunnel.PutInTunnel(Transform, Position); }
public TunnelVector3(TunnelVector3 preset) { _depth = preset._depth; _angleDegrees = preset._angleDegrees; _height = preset._height; }