Пример #1
0
        /** Direction and distance to move in a single frame to avoid obstacles.
         * \param deltaTime How far to move [seconds].
         *      Usually set to Time.deltaTime.
         */
        //GG

        /*public Vector3 CalculateMovementDelta (float deltaTime) {
         *              if (rvoAgent == null) return Vector3.zero;
         *              return To3D(Vector2.ClampMagnitude(rvoAgent.CalculatedTargetPoint - To2D(ai != null ? ai.position : tr.position), rvoAgent.CalculatedSpeed * deltaTime), 0);
         *      }*/
        public VInt3 CalculateMovementDelta(int deltaTimeMS)
        {
            if (rvoAgent == null)
            {
                return(VInt3.zero);
            }
            //Debug.Log($"--calculate target--{rvoAgent.CalculatedTargetPoint}");
            return(To3D(VInt2.ClampMagnitude(rvoAgent.CalculatedTargetPoint - To2D(ai != null ? (VInt3)ai.position : (VInt3)tr.position), (int)(rvoAgent.CalculatedSpeed * deltaTimeMS)), 0));
        }
Пример #2
0
        /** Direction and distance to move in a single frame to avoid obstacles.
         * \param position Position of the agent.
         * \param deltaTime How far to move [seconds].
         *      Usually set to Time.deltaTime.
         */
        //GG

        /*public Vector3 CalculateMovementDelta (Vector3 position, float deltaTime) {
         *              return To3D(Vector2.ClampMagnitude(rvoAgent.CalculatedTargetPoint - To2D(position), rvoAgent.CalculatedSpeed * deltaTime), 0);
         *      }*/
        public VInt3 CalculateMovementDelta(VInt3 position, int deltaTimeMS)
        {
            return(To3D(VInt2.ClampMagnitude(rvoAgent.CalculatedTargetPoint - To2D(position), rvoAgent.CalculatedSpeed * deltaTimeMS), 0));
        }