• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# critterai.Vector3类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中org.critterai.Vector3的典型用法代码示例。如果您正苦于以下问题:C# org.critterai.Vector3类的具体用法?C# org.critterai.Vector3怎么用?C# org.critterai.Vector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



org.critterai.Vector3类属于命名空间,在下文中一共展示了org.critterai.Vector3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
开发者ID:BibleUs,项目名称:critterai,代码行数:7,代码来源:NavmeshQueryEx.cs


示例2: AreaBoxMarker

 private AreaBoxMarker(string name, int priority, byte area
     , Vector3 boundsMin, Vector3 boundsMax)
     : base(name, priority, area)
 {
     mBoundsMin = boundsMin;
     mBoundsMax = boundsMax;
 }
开发者ID:matrix889,项目名称:kbengine_unity3d_warring,代码行数:7,代码来源:AreaBoxMarker.cs


示例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);
 }
开发者ID:BibleUs,项目名称:critterai,代码行数:8,代码来源:AreaCylinderMarker.cs


示例4: InputGeometryBuilder

 private InputGeometryBuilder(ChunkyTriMeshBuilder builder
     , Vector3 boundsMin
     , Vector3 boundsMax
     , bool isThreadSafe)
 {
     mBuilder = builder;
     mBoundsMin = boundsMin;
     mBoundsMax = boundsMax;
     mIsThreadSafe = isThreadSafe;
 }
开发者ID:GamesDesignArt,项目名称:unity3d_nav_critterai,代码行数:10,代码来源:InputGeometryBuilder.cs


示例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;
 }
开发者ID:GamesDesignArt,项目名称:unity3d_nav_critterai,代码行数:10,代码来源:ConnectionSet.cs


示例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;
 }
开发者ID:BibleUs,项目名称:critterai,代码行数:12,代码来源:ContourSetEx.cs


示例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;
 }
开发者ID:kbefans,项目名称:kbengine_unity3d_warring,代码行数:12,代码来源:AreaConvexMarker.cs


示例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);
        }
开发者ID:kbefans,项目名称:kbengine_unity3d_warring,代码行数:20,代码来源:InputGeometryCompiler.cs


示例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;
 }
开发者ID:BibleUs,项目名称:critterai,代码行数:14,代码来源:TileSetDefinition.cs


示例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);
        }
开发者ID:BibleUs,项目名称:critterai,代码行数:34,代码来源:Triangle3.cs


示例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;
        }
开发者ID:GamesDesignArt,项目名称:unity3d_nav_critterai,代码行数:45,代码来源:Polygon3.cs


示例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 &lt;= value &lt;= <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);
 }
开发者ID:BibleUs,项目名称:critterai,代码行数:27,代码来源:PathCorridor.cs


示例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);
 }
开发者ID:BibleUs,项目名称:critterai,代码行数:27,代码来源:PathCorridor.cs


示例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;
        }
开发者ID:BibleUs,项目名称:critterai,代码行数:34,代码来源:PathCorridor.cs


示例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);
 }
开发者ID:BibleUs,项目名称:critterai,代码行数:20,代码来源:PathCorridor.cs


示例16: OptimizePathVisibility

 /// <summary>
 /// Attempts to optimize the path if the specified point is visible from the current 
 /// position.
 /// </summary>
 /// <remarks>
 /// <para>
 /// Improves pathfinding appearance when using meshes that contain non-border.
 /// vertices.  (E.g. Tiled meshes and meshes constructed using multiple areas.)
 /// </para>
 /// <para>
 /// The only time <paramref name="updateCorners"/> should be set to false is if a move 
 /// or other optimization method is to be called next. Otherwise the corner data may 
 /// become invalid.
 /// </para>
 /// <para>
 /// Inaccurate locomotion or dynamic obstacle avoidance can force the agent position 
 /// significantly outside the original corridor. Over time this can result in the 
 /// formation of a non-optimal corridor. A non-optimal corridor can also form near
 /// non-border vertices.  (I.e. At tile corners or area transitions.)
 /// </para>
 /// <para>
 /// This function uses an efficient local visibility search to try to optimize the corridor
 /// between the current position and <paramref name="next"/>.
 /// </para>
 /// <para>
 /// The corridor will change only if <paramref name="next"/> is visible from the 
 /// current position and moving directly toward the point is better than following the 
 /// existing path.
 /// </para>
 /// <para>
 /// The more inaccurate the client movement, the more beneficial this method becomes.  
 /// Simply adjust the frequency of the call to match the needs to the client.
 /// </para>
 /// <para>
 /// This method is not suitable for long distance searches.
 /// </para>
 /// </remarks>
 /// <param name="next">The point to search toward.</param>
 /// <param name="optimizationRange">The maximum range to search. [Limit: > 0]</param>
 /// <param name="updateCorners">True if the corners data should be refreshed.</param>
 public void OptimizePathVisibility(Vector3 next, float optimizationRange
     , bool updateCorners)
 {
     if (updateCorners)
     {
         mCorners.cornerCount = PathCorridorEx.dtpcOptimizePathVisibilityExt(mRoot
             , ref next, optimizationRange
             , mCorners.verts, mCorners.flags, mCorners.polyRefs, mCorners.polyRefs.Length
             , mQuery.root, mFilter.root);
     }
     else
     {
         PathCorridorEx.dtpcOptimizePathVisibility(
             mRoot, ref next, optimizationRange, mQuery.root, mFilter.root);
     }
 }
开发者ID:BibleUs,项目名称:critterai,代码行数:56,代码来源:PathCorridor.cs


示例17: UnsafeCreate

 /// <summary>
 /// Creates a connection set.
 /// </summary>
 /// <remarks>
 /// <para>
 /// Connection sets created using this method are not guarenteed to be valid or
 /// safe for threaded builds.
 /// </para>
 /// <para>
 /// The generated connection set will directly reference the construction
 /// parameters.
 /// </para>
 /// </remarks>
 /// <param name="verts">The connection vertices. [(start, end) * connCount]</param>
 /// <param name="radii">The connection radii. [Length: connCount]</param>
 /// <param name="dirs">The connection direction flags. [Length: connCount]</param>
 /// <param name="areas">The connection areas. [Length: connCount]</param>
 /// <param name="flags">The connection flags. [Length: connCount]</param>
 /// <param name="userIds">The connection user ids. [Length: connCount]</param>
 /// <returns>An unsafe connection set.</returns>
 public static ConnectionSet UnsafeCreate(Vector3[] verts, float[] radii
     , byte[] dirs, byte[] areas, ushort[] flags, uint[] userIds)
 {
     return new ConnectionSet(verts
         , radii
         , dirs
         , areas
         , flags
         , userIds);
 }
开发者ID:GamesDesignArt,项目名称:unity3d_nav_critterai,代码行数:30,代码来源:ConnectionSet.cs


示例18: IsValid

        /// <summary>
        /// Validates the structure and, optionally, the content of the mesh.
        /// </summary>
        /// <remarks>
        /// <para>
        /// The basic structural validation includes null checks, array size checks, etc.
        /// </para>
        /// <para>
        /// The optional content validation checks that the indices refer to valid vertices 
        /// and that triangles do not contain duplicate vertices.
        /// </para>
        /// </remarks>
        /// <param name="verts">The mesh vertices.</param>
        /// <param name="vertCount">The vertex count.</param>
        /// <param name="tris">The triangle indices.</param>
        /// <param name="triCount">The triangle count.</param>
        /// <param name="includeContent">
        /// If true, the content will be checked.  Otherwise only the structure will be checked.
        /// </param>
        /// <returns>True if the validation tests pass.</returns>
        public static bool IsValid(Vector3[] verts, int vertCount
            , int[] tris, int triCount
            , bool includeContent)
        {
            if (tris == null || verts == null
                || triCount * 3 > tris.Length
                || vertCount > verts.Length
                || triCount < 0 || vertCount < 0)
            {
                return false;
            }

            if (includeContent)
            {
                int length = triCount * 3;

                for (int p = 0; p < length; p += 3)
                {
                    int a = tris[p + 0];
                    int b = tris[p + 1];
                    int c = tris[p + 2];

                    if (a < 0 || a >= vertCount
                        || b < 0 || b >= vertCount
                        || c < 0 || c >= vertCount
                        || a == b || b == c || c == a)
                    {
                        return false;
                    }
                }
            }

            return true;
        }
开发者ID:moto2002,项目名称:critterai,代码行数:54,代码来源:TriangleMesh.cs


示例19: OffMeshConnection

 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="start">The start point.</param>
 /// <param name="end">The end point.</param>
 /// <param name="radius">The radius of the start and end points. [Limit: >0]</param>
 /// <param name="isBidDrectional">True if the connection is bi-directional.</param>
 /// <param name="area">The area. [Limit: &lt;= <see cref="Navmesh.MaxArea"/>].</param>
 /// <param name="flags">The connection flags.</param>
 /// <param name="userId">The id of the off-mesh connection. (User defined.)</param>
 public OffMeshConnection(Vector3 start, Vector3 end
     ,float radius, bool isBidDrectional, byte area, ushort flags, uint userId)
 {
     this.start = start;
     this.end = end;
     this.radius = MathUtil.ClampToPositiveNonZero(radius);
     direction = (byte)(isBidDrectional ? 1 : 0);
     this.area = NavUtil.ClampArea(area);
     this.flags = flags;
     this.userId = userId;
 }
开发者ID:BibleUs,项目名称:critterai,代码行数:21,代码来源:OffMeshConnection.cs


示例20: GetVerts

        /// <summary>
        /// Gets a copy of the vertex buffer.
        /// </summary>
        /// <param name="buffer">
        /// The buffer to load the results into.
        /// [Length: >= <see cref="NavmeshTileHeader.vertCount"/>]
        /// </param>
        /// <returns>The number of vertices returned.</returns>
        public int GetVerts(Vector3[] buffer)
        {
            if (mOwner.IsDisposed || buffer == null)
                return 0;

            return NavmeshTileEx.dtnmGetTileVerts(mTile
                , buffer
                , buffer.Length);
        }
开发者ID:kbengine,项目名称:unity3d_nav_critterai,代码行数:17,代码来源:NavmeshTile.cs



注:本文中的org.critterai.Vector3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# runtime.Runtime类代码示例发布时间:2022-05-24
下一篇:
C# util.CharArraySet类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap