本文整理汇总了C#中org.critterai.Vector3类的典型用法代码示例。如果您正苦于以下问题:C# org.critterai.Vector3类的具体用法?C# org.critterai.Vector3怎么用?C# org.critterai.Vector3使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
org.critterai.Vector3类属于命名空间,在下文中一共展示了org.critterai.Vector3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: dtqQueryPolygons
public static extern NavStatus dtqQueryPolygons(IntPtr query
, ref Vector3 position
, ref Vector3 extents
, IntPtr filter
, [In, Out] uint[] resultPolyRefs
, ref int resultCount
, int maxResult);
示例2: AreaBoxMarker
private AreaBoxMarker(string name, int priority, byte area
, Vector3 boundsMin, Vector3 boundsMax)
: base(name, priority, area)
{
mBoundsMin = boundsMin;
mBoundsMax = boundsMax;
}
示例3: AreaCylinderMarker
private AreaCylinderMarker(string name, int priority, byte area
, Vector3 centerBase, float radius, float height)
: base(name, priority, area)
{
mCenterBase = centerBase;
mRadius = Math.Max(0, radius);
mHeight = Math.Max(0, height);
}
示例4: InputGeometryBuilder
private InputGeometryBuilder(ChunkyTriMeshBuilder builder
, Vector3 boundsMin
, Vector3 boundsMax
, bool isThreadSafe)
{
mBuilder = builder;
mBoundsMin = boundsMin;
mBoundsMax = boundsMax;
mIsThreadSafe = isThreadSafe;
}
示例5: ConnectionSet
private ConnectionSet(Vector3[] verts, float[] radii
, byte[] dirs, byte[] areas, ushort[] flags, uint[] userIds)
{
this.verts = verts;
this.radii = radii;
this.dirs = dirs;
this.areas = areas;
this.flags = flags;
this.userIds = userIds;
}
示例6: Reset
public void Reset()
{
contourCount = 0;
contours = IntPtr.Zero;
boundsMax = Vector3Util.Zero;
boundsMin = Vector3Util.Zero;
xzCellSize = 0;
yCellSize = 0;
width = 0;
depth = 0;
borderSize = 0;
}
示例7: AreaConvexMarker
private AreaConvexMarker(string name
, int priority
, byte area
, Vector3[] verts
, float ymin
, float ymax)
: base(name, priority, area)
{
this.verts = verts;
this.ymin = ymin;
this.ymax = ymax;
}
示例8: AddTriangle
/// <summary>
/// Adds a single triangle.
/// </summary>
/// <param name="vertA">Vertex A of triangle ABC.</param>
/// <param name="vertB">Vertex B of triangle ABC.</param>
/// <param name="vertC">Vertex C of triangle ABC.</param>
/// <param name="area">The triangle area.</param>
public void AddTriangle(Vector3 vertA, Vector3 vertB, Vector3 vertC, byte area)
{
mTris.Add(mVerts.Count);
mVerts.Add(vertA);
mTris.Add(mVerts.Count);
mVerts.Add(vertB);
mTris.Add(mVerts.Count);
mVerts.Add(vertC);
mAreas.Add(area);
}
示例9: TileSetDefinition
private TileSetDefinition(int width, int depth
, Vector3 boundsMin, Vector3 boundsMax
, NMGenParams config
, InputGeometry geom)
{
// Note: The constructor is private, which is why
// the references are being stored.
mBaseConfig = config.Clone();
mGeometry = geom;
mWidth = width;
mDepth = depth;
mBoundsMin = boundsMin;
mBoundsMax = boundsMax;
}
示例10: GetAreaComp
/// <summary>
/// Returns a value suitable for comparing the relative area of two triangles. (E.g.
/// Is triangle A larger than triangle B.)
/// </summary>
/// <remarks>
/// <para>
/// The value returned by this method can be converted to an area as follows:
/// <c>Area = Math.sqrt(value) / 2</c>
/// </para>
/// <para>
/// Useful for cheaply comparing the size of triangles.
/// </para>
/// </remarks>
/// <param name="a">Vertex A of triangle ABC.</param>
/// <param name="b">Vertex B of triangle ABC.</param>
/// <param name="c">Vertex C of triangle ABC.</param>
/// <returns>A value suitable for comparing the relative area of two triangles.</returns>
public static float GetAreaComp(Vector3 a, Vector3 b, Vector3 c)
{
// References:
// http://softsurfer.com/Archive/algorithm_0101/algorithm_0101.htm#Modern%20Triangles
// Get directional vectors.
Vector3 u = b - a; // A -> B
Vector3 v = c - a; // A -> C
// Cross product.
Vector3 n = new Vector3(u.y * v.z - u.z * v.y
, -u.x * v.z + u.z * v.x
, u.x * v.y - u.y * v.x);
return Vector3Util.GetLengthSq(n);
}
示例11: GetCentroid
/// <summary>
/// Returns the <a href="http://en.wikipedia.org/wiki/Centroid" target="_blank">
/// centroid</a> of a convex polygon.
/// </summary>
/// <remarks>
/// <para>
/// Behavior is undefined if the polygon is not convex.
/// </para>
/// <para>
/// Behavior is undefined if the vector being overwritten in the out array is a vertex
/// in the polygon. (Can only happen if the vertices and result arrays are the same object.)
/// </para>
/// </remarks>
/// <param name="vertices">
/// An array of vertices that contains a representation of a polygon with an arbitrary
/// number of sides. Wrap direction does not matter.
/// </param>
/// <param name="startVert">The index of the first vertex in the polygon.</param>
/// <param name="vertCount">The number of vertices in the polygon.</param>
/// <param name="result">The array to store the result in.</param>
/// <param name="resultVert">The index in the result array to store the result.</param>
/// <returns>A reference to the result argument.</returns>
public static Vector3[] GetCentroid(Vector3[] vertices
, int startVert
, int vertCount
, Vector3[] result
, int resultVert)
{
// Reference:
// http://en.wikipedia.org/wiki/Centroid#Of_a_finite_set_of_points
result[resultVert] = new Vector3(0, 0, 0);
int length = (startVert+vertCount);
for (int i = startVert; i < length; i++)
{
result[resultVert] += vertices[i];
}
result[resultVert].x /= vertCount;
result[resultVert].y /= vertCount;
result[resultVert].z /= vertCount;
return result;
}
示例12: SetCorridor
/// <summary>
/// Loads a new path and target into the corridor.
/// </summary>
/// <remarks>
/// <para>
/// The current position is expected to be within the first
/// polygon in the path. The target is expected to be in the last
/// polygon.
/// </para>
/// </remarks>
/// <param name="target">The target location within the last polygon of the path.</param>
/// <param name="path">
/// The path corridor. [(polyRef) * <paramref name="pathCount"/>]
/// </param>
/// <param name="pathCount">
/// The number of polygons in the path.
/// [Limits: 0 <= value <= <see cref="MaxPathSize"/>]
/// </param>
public void SetCorridor(Vector3 target
, uint[] path
, int pathCount)
{
mCorners.cornerCount = PathCorridorEx.dtpcSetCorridor(mRoot
, ref target, path, pathCount, ref mTarget
, mCorners.verts, mCorners.flags, mCorners.polyRefs, mCorners.polyRefs.Length
, mQuery.root, mFilter.root);
}
示例13: Move
/// <summary>
/// Moves the position and target from their curent locations to the desired locations.
/// </summary>
/// <remarks>
/// <para>
/// Performs an aggregrate operation in the following order:
/// </para>
/// <ol>
/// <li><see cref="MoveTarget"/></li>
/// <li><see cref="MovePosition"/></li>
/// </ol>
/// <para>
/// See the documentation of the related functions for details on behavior.
/// </para>
/// <para>
/// This method is more efficient than calling the other methods individually.
/// </para>
/// </remarks>
/// <param name="desiredPosition">The desired position.</param>
/// <param name="desiredTarget">The desired target.</param>
public void Move(Vector3 desiredPosition, Vector3 desiredTarget)
{
mCorners.cornerCount = PathCorridorEx.dtpcMove(mRoot
, ref desiredPosition, ref desiredTarget, ref mPosition, ref mTarget
, mCorners.verts, mCorners.flags, mCorners.polyRefs, mCorners.polyRefs.Length
, mQuery.root, mFilter.root);
}
示例14: MoveTarget
/// <summary>
/// Moves the target from its curent location to the desired location, adjusting the
/// corridor as needed to reflect the change.
/// </summary>
/// <remarks>
/// <para>
/// Behavior:
/// </para>
/// <ul>
/// <li>The movement is constrained to the surface of the navigation mesh.</li>
/// <li>The corridor is automatically adjusted (shorted or lengthened) and
/// <see cref="Corners"/> updated in order to remain valid.</li>
/// <li>The new position will be located in the adjusted corridor's last polygon.</li>
/// </ul>
/// <para>
/// The expected use case: The desired target will be 'near' the corridor. What is
/// considered 'near' depends on local polygon density, query search extents, etc.
/// </para>
/// <para>
/// The resulting target will differ from the desired target if the desired target is
/// not on the navigation mesh, or it can't be reached using a local search.
/// </para>
/// </remarks>
/// <param name="desiredTarget">The desired target.</param>
/// <returns>The result of the move.</returns>
public NavmeshPoint MoveTarget(Vector3 desiredTarget)
{
mCorners.cornerCount = PathCorridorEx.dtpcMoveTargetPosition(mRoot
, ref desiredTarget, ref mTarget
, mCorners.verts, mCorners.flags, mCorners.polyRefs, mCorners.polyRefs.Length
, mQuery.root, mFilter.root);
return mTarget;
}
示例15: MoveOverConnection
/// <summary>
/// Moves over an off-mesh connection.
/// </summary>
/// <remarks>
/// <para>
/// This method is minimally tested and documented.
/// </para>
/// </remarks>
/// <param name="connectionRef">The connection polygon reference.</param>
/// <param name="endpointRefs">Polygon endpoint references. [Length: 2]</param>
/// <param name="startPosition">The start position.</param>
/// <param name="endPosition">The end position.</param>
/// <returns>True if the operation succeeded.</returns>
public bool MoveOverConnection(uint connectionRef, uint[] endpointRefs
, Vector3 startPosition, Vector3 endPosition)
{
return PathCorridorEx.dtpcMoveOverOffmeshConnection(mRoot
, connectionRef, endpointRefs, ref startPosition, ref endPosition, ref mPosition
, mQuery.root);
}