Tanoda
GILES.pb_HandleUtility Class Reference

Static Public Member Functions

static bool ClosestPointsOnTwoLines (Vector3 linePoint1, Vector3 lineVec1, Vector3 linePoint2, Vector3 lineVec2, out Vector3 closestPointLine1, out Vector3 closestPointLine2)
 
static bool PointOnLine (Ray InLineA, Ray InLineB, out Vector3 OutPointA, out Vector3 OutPointB)
 
static bool PointOnPlane (Ray ray, Vector3 planePosition, Vector3 planeNormal, out Vector3 hit)
 
static bool PointOnPlane (Ray ray, Plane plane, out Vector3 hit)
 
static Vector3 DirectionMask (Transform target, Vector3 rayDirection)
 
static float CalcMouseDeltaSignWithAxes (Camera cam, Vector3 origin, Vector3 upDir, Vector3 rightDir, Vector2 mouseDelta)
 
static float CalcSignedMouseDelta (Vector2 lhs, Vector2 rhs)
 
static float GetHandleSize (Vector3 position)
 
static Ray TransformRay (Ray ray, Transform transform)
 
static GameObject ObjectRaycast (Ray ray, IEnumerable< GameObject > objects, bool ignoreSelection=false)
 
static GameObject ObjectRaycast (Ray ray, IEnumerable< GameObject > objects, float maxdist, bool ignoreMeshFilter=false)
 
static GameObject ObjectRaycast (Ray ray, IEnumerable< GameObject > objects, float maxdist, bool ignoreMeshFilter=false, List< GameObject > ignoreList=null)
 
static GameObject ObjectRaycast (Ray ray, IEnumerable< GameObject > objects, out pb_RaycastHit besthit)
 
static bool MeshRaycast (Mesh mesh, Ray ray, out pb_RaycastHit hit)
 
static float DistancePoint2DToLine (Camera cam, Vector2 mousePosition, Vector3 worldPosition1, Vector3 worldPosition2)
 
static float DistancePointLineSegment (Vector2 p, Vector2 v, Vector2 w)
 
static bool PointInPolygon (Vector2[] polygon, Vector2 point)
 
static bool GetLineSegmentIntersect (Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3)
 

Detailed Description

Collection of static methods commonly used when working with scene handles.

Definition at line 11 of file pb_HandleUtility.cs.

Member Function Documentation

◆ CalcMouseDeltaSignWithAxes()

static float GILES.pb_HandleUtility.CalcMouseDeltaSignWithAxes ( Camera  cam,
Vector3  origin,
Vector3  upDir,
Vector3  rightDir,
Vector2  mouseDelta 
)
static

When dragging in 3d space, this returns the signed delta based on handle orientation.

Definition at line 113 of file pb_HandleUtility.cs.

◆ CalcSignedMouseDelta()

static float GILES.pb_HandleUtility.CalcSignedMouseDelta ( Vector2  lhs,
Vector2  rhs 
)
static

Calculates a signed float delta from a current and previous mouse position.

Parameters
lhsCurrent mouse position.
rhsPrevious mouse position.

Definition at line 136 of file pb_HandleUtility.cs.

◆ ClosestPointsOnTwoLines()

static bool GILES.pb_HandleUtility.ClosestPointsOnTwoLines ( Vector3  linePoint1,
Vector3  lineVec1,
Vector3  linePoint2,
Vector3  lineVec2,
out Vector3  closestPointLine1,
out Vector3  closestPointLine2 
)
static

Returns the nearest point on each line to the other line.

http://wiki.unity3d.com/index.php?title=3d_Math_functions Two non-parallel lines which may or may not touch each other have a point on each line which are closest to each other. This function finds those two points. If the lines are not parallel, the function outputs true, otherwise false.

Definition at line 22 of file pb_HandleUtility.cs.

◆ DirectionMask()

static Vector3 GILES.pb_HandleUtility.DirectionMask ( Transform  target,
Vector3  rayDirection 
)
static

Definition at line 102 of file pb_HandleUtility.cs.

◆ DistancePoint2DToLine()

static float GILES.pb_HandleUtility.DistancePoint2DToLine ( Camera  cam,
Vector2  mousePosition,
Vector3  worldPosition1,
Vector3  worldPosition2 
)
static

Return the signed distance from a mouse position to a line in screen space.

Definition at line 449 of file pb_HandleUtility.cs.

◆ DistancePointLineSegment()

static float GILES.pb_HandleUtility.DistancePointLineSegment ( Vector2  p,
Vector2  v,
Vector2  w 
)
static
Get the distance between a point and a finite line segment.

http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment

Definition at line 461 of file pb_HandleUtility.cs.

◆ GetHandleSize()

static float GILES.pb_HandleUtility.GetHandleSize ( Vector3  position)
static

Return the screen to world space ratio for this point in world space.

Definition at line 151 of file pb_HandleUtility.cs.

◆ GetLineSegmentIntersect()

static bool GILES.pb_HandleUtility.GetLineSegmentIntersect ( Vector2  p0,
Vector2  p1,
Vector2  p2,
Vector2  p3 
)
static

True or false lines intersect.

Definition at line 529 of file pb_HandleUtility.cs.

◆ MeshRaycast()

static bool GILES.pb_HandleUtility.MeshRaycast ( Mesh  mesh,
Ray  ray,
out pb_RaycastHit  hit 
)
static

Definition at line 416 of file pb_HandleUtility.cs.

◆ ObjectRaycast() [1/4]

static GameObject GILES.pb_HandleUtility.ObjectRaycast ( Ray  ray,
IEnumerable< GameObject >  objects,
bool  ignoreSelection = false 
)
static

Return the nearest hit object in scene. Does not require a collider.

Definition at line 176 of file pb_HandleUtility.cs.

◆ ObjectRaycast() [2/4]

static GameObject GILES.pb_HandleUtility.ObjectRaycast ( Ray  ray,
IEnumerable< GameObject >  objects,
float  maxdist,
bool  ignoreMeshFilter = false 
)
static

Return the nearest hit object in scene. Does not require a collider.

Definition at line 232 of file pb_HandleUtility.cs.

◆ ObjectRaycast() [3/4]

static GameObject GILES.pb_HandleUtility.ObjectRaycast ( Ray  ray,
IEnumerable< GameObject >  objects,
float  maxdist,
bool  ignoreMeshFilter = false,
List< GameObject >  ignoreList = null 
)
static

Definition at line 294 of file pb_HandleUtility.cs.

◆ ObjectRaycast() [4/4]

static GameObject GILES.pb_HandleUtility.ObjectRaycast ( Ray  ray,
IEnumerable< GameObject >  objects,
out pb_RaycastHit  besthit 
)
static

Return the nearest hit object in scene. Does not require a collider.

Definition at line 363 of file pb_HandleUtility.cs.

◆ PointInPolygon()

static bool GILES.pb_HandleUtility.PointInPolygon ( Vector2[]  polygon,
Vector2  point 
)
static

Returns true if the polygon contains point. False otherwise. Casts a ray from outside the bounds to the polygon and checks how many edges are hit.

Parameters
polygonA series of individual edges composing a polygon. polygon length must be divisible by 2.

Definition at line 493 of file pb_HandleUtility.cs.

◆ PointOnLine()

static bool GILES.pb_HandleUtility.PointOnLine ( Ray  InLineA,
Ray  InLineB,
out Vector3  OutPointA,
out Vector3  OutPointB 
)
static

Return the nearest point on each ray to the other ray.

See also
ClosestPointOnTwoLines

Definition at line 58 of file pb_HandleUtility.cs.

◆ PointOnPlane() [1/2]

static bool GILES.pb_HandleUtility.PointOnPlane ( Ray  ray,
Plane  plane,
out Vector3  hit 
)
static

Return the point on a plane where a ray intersects.

Definition at line 74 of file pb_HandleUtility.cs.

◆ PointOnPlane() [2/2]

static bool GILES.pb_HandleUtility.PointOnPlane ( Ray  ray,
Vector3  planePosition,
Vector3  planeNormal,
out Vector3  hit 
)
static

Return the point on a plane where a ray intersects.

Definition at line 66 of file pb_HandleUtility.cs.

◆ TransformRay()

static Ray GILES.pb_HandleUtility.TransformRay ( Ray  ray,
Transform  transform 
)
static

Transform world ray into model space.

Definition at line 165 of file pb_HandleUtility.cs.


The documentation for this class was generated from the following file: