亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? steeringbehavior.vb

?? 一個.Net下用VB編寫的用于游戲的人工智能引擎
?? VB
?? 第 1 頁 / 共 5 頁
字號:
Imports SteeringVB.ParamLoader

Public Class SteeringBehavior
    '//--------------------------- Constants ----------------------------------

    '//the radius of the constraining circle for the wander behavior
    Public Const WanderRad As Double = 1.2
    '//distance the wander circle is projected in front of the agent
    Public Const WanderDist As Double = 2.0
    '//the maximum amount of displacement along the circle each frame
    Public Const WanderJitterPerSec As Double = 80.0

    '//used in path following
    Public Const WaypointSeekDist As Double = 20

    '//------------------------------------------------------------------------

    Private Enum behavior_type
        none = &H0
        seek = &H2
        flee = &H4
        arrive = &H8
        wander = &H10
        cohesion = &H20
        separation = &H40
        allignment = &H80
        obstacle_avoidance = &H100
        wall_avoidance = &H200
        follow_path = &H400
        pursuit = &H800
        evade = &H1000
        interpose = &H2000
        hide = &H4000
        flock = &H8000
        offset_pursuit = &H10000
    End Enum

    '//Arrive makes use of these to determine how quickly a vehicle
    '//should decelerate to its target
    Private Enum Deceleration
        slow = 3
        normal = 2
        fast = 1
    End Enum


    '//a pointer to the owner of this instance
    Dim m_pVehicle As Vehicle

    '//the steering force created by the combined effect of all
    '//the selected behaviors
    Dim m_vSteeringForce As New Vector2D

    '//these can be used to keep track of friends, pursuers, or prey
    Dim m_pTargetAgent1 As Vehicle
    Dim m_pTargetAgent2 As Vehicle

    '//the current target
    Dim m_vTarget As Vector2D

    '//length of the 'detection box' utilized in obstacle avoidance
    Dim m_dDBoxLength As Double


    '//a vertex buffer to contain the feelers rqd for wall avoidance  
    Dim m_Feelers As ArrayList

    '//the length of the 'feeler/s' used in wall detection
    Dim m_dWallDetectionFeelerLength As Double



    '//the current position on the wander circle the agent is
    '//attempting to steer towards
    Dim m_vWanderTarget As Vector2D

    '//explained above
    Dim m_dWanderJitter As Double
    Dim m_dWanderRadius As Double
    Dim m_dWanderDistance As Double


    '//multipliers. These can be adjusted to effect strength of the  
    '//appropriate behavior. Useful to get flocking the way you require
    '//for example.
    Dim m_dWeightSeparation As Double
    Dim m_dWeightCohesion As Double
    Dim m_dWeightAlignment As Double
    Dim m_dWeightWander As Double
    Dim m_dWeightObstacleAvoidance As Double
    Dim m_dWeightWallAvoidance As Double
    Dim m_dWeightSeek As Double
    Dim m_dWeightFlee As Double
    Dim m_dWeightArrive As Double
    Dim m_dWeightPursuit As Double
    Dim m_dWeightOffsetPursuit As Double
    Dim m_dWeightInterpose As Double
    Dim m_dWeightHide As Double
    Dim m_dWeightEvade As Double
    Dim m_dWeightFollowPath As Double

    '//how far the agent can 'see'
    Dim m_dViewDistance As Double

    '//pointer to any current path
    Dim m_pPath As _Path

    '//the distance (squared) a vehicle has to be from a path waypoint before
    '//it starts seeking to the next waypoint
    Dim m_dWaypointSeekDistSq As Double


    '//any offset used for formations or offset pursuit
    Dim m_vOffset As Vector2D



    '//binary flags to indicate whether or not a behavior should be active
    Dim m_iFlags As behavior_type


    '//default
    Dim m_Deceleration As Deceleration

    '//is cell space partitioning to be used or not?
    Dim m_bCellSpaceOn As Boolean

    '//what type of method is used to sum any active behavior
    Dim m_SummingMethod As summing_method


    '//this function tests if a specific bit of m_iFlags is set
    Private Function IsOn(ByVal bt As behavior_type) As Boolean
        Return (m_iFlags And bt) = bt
    End Function

    '//--------------------- AccumulateForce ----------------------------------
    '//
    '//  This function calculates how much of its max steering force the 
    '//  vehicle has left to apply and then applies that amount of the
    '//  force to add.
    '//------------------------------------------------------------------------
    Private Function AccumulateForce(ByVal RunningTot As Vector2D, ByVal ForceToAdd As Vector2D) As Boolean
        '//calculate how much steering force the vehicle has used so far
        Dim MagnitudeSoFar As Double = RunningTot.Length()

        '//calculate how much steering force remains to be used by this vehicle
        Dim MagnitudeRemaining As Double = m_pVehicle.MaxForce() - MagnitudeSoFar

        '//return false if there is no more force left to use
        If MagnitudeRemaining <= 0.0 Then Return False

        '//calculate the magnitude of the force we want to add
        Dim MagnitudeToAdd As Double = ForceToAdd.Length()

        '//if the magnitude of the sum of ForceToAdd and the running total
        '//does not exceed the maximum force available to this vehicle, just
        '//add together. Otherwise add as much of the ForceToAdd vector is
        '//possible without going over the max.
        If (MagnitudeToAdd < MagnitudeRemaining) Then
            RunningTot.PlusEqual(ForceToAdd)

        Else
            '//add it to the steering force
            RunningTot.PlusEqual(Vector2D.Vec2DNormalize(ForceToAdd).Mutiply(MagnitudeRemaining))

        End If

        Return True

    End Function

    '//creates the antenna utilized by the wall avoidance behavior
    '//------------------------------- CreateFeelers --------------------------
    '//
    '//  Creates the antenna utilized by WallAvoidance
    '//------------------------------------------------------------------------
    Private Sub CreateFeelers()
        m_Feelers.Clear()
        '//feeler pointing straight in front
        m_Feelers.Add(m_pVehicle.Pos().Plus(m_pVehicle.Heading().Mutiply(m_dWallDetectionFeelerLength)))

        '//feeler to left
        Dim temp As Vector2D = m_pVehicle.Heading()
        Transformations.Vec2DRotateAroundOrigin(temp, Utils.HalfPi * 3.5F)
        m_Feelers.Add(m_pVehicle.Pos().Plus(temp.Mutiply(m_dWallDetectionFeelerLength / 2.0F)))

        '//feeler to right
        temp = m_pVehicle.Heading()
        Transformations.Vec2DRotateAroundOrigin(temp, Utils.HalfPi * 0.5F)
        m_Feelers.Add(m_pVehicle.Pos().Plus(temp.Mutiply(m_dWallDetectionFeelerLength / 2.0F)))

    End Sub

    '/* .......................................................

    '                    BEGIN BEHAVIOR DECLARATIONS

    '.......................................................*/


    '/////////////////////////////////////////////////////////////////////////////// START OF BEHAVIORS
    '//------------------------------- Seek -----------------------------------
    '//
    '//  Given a target, this behavior returns a steering force which will
    '//  direct the agent towards the target
    '//------------------------------------------------------------------------
    '//this behavior moves the agent towards a target position
    Private Function Seek(ByVal TargetPos As Vector2D) As Vector2D
        Dim DesiredVelocity As Vector2D = Vector2D.Vec2DNormalize(TargetPos.Minus(m_pVehicle.Pos())).Mutiply(m_pVehicle.MaxSpeed())
        Return DesiredVelocity.Minus(m_pVehicle.Velocity())
    End Function

    '//----------------------------- Flee -------------------------------------
    '//
    '//  Does the opposite of Seek
    '//------------------------------------------------------------------------
    '//this behavior returns a vector that moves the agent away
    '//from a target position
    Private Function Flee(ByVal TargetPos As Vector2D) As Vector2D

        '//only flee if the target is within 'panic distance'. Work in distance
        '//squared space.
        '/* const double PanicDistanceSq = 100.0f * 100.0;
        'if (Vec2DDistanceSq(m_pVehicle->Pos(), target) > PanicDistanceSq)
        '{
        'return Vector2D(0,0);
        '}
        '*/

        Dim DesiredVelocity As Vector2D = Vector2D.Vec2DNormalize(m_pVehicle.Pos().Minus(TargetPos)).Mutiply(m_pVehicle.MaxSpeed())
        Return DesiredVelocity.Minus(m_pVehicle.Velocity())
    End Function

    '//this behavior is similar to seek but it attempts to arrive 
    '//at the target position with a zero velocity
    '//--------------------------- Arrive -------------------------------------
    '//
    '//  This behavior is similar to seek but it attempts to arrive at the
    '//  target with a zero velocity
    '//------------------------------------------------------------------------
    Private Function Arrive(ByVal TargetPos As Vector2D, ByVal deceleration As Deceleration) As Vector2D
        Dim ToTarget As Vector2D = TargetPos.Minus(m_pVehicle.Pos())

        '//calculate the distance to the target
        Dim dist As Double = ToTarget.Length()

        If dist > 0 Then
            '//because Deceleration is enumerated as an int, this value is required
            '//to provide fine tweaking of the deceleration..
            Dim DecelerationTweaker As Double = 0.3

            '//calculate the speed required to reach the target given the desired
            '//deceleration
            Dim speed As Double = dist / (CDbl(deceleration * DecelerationTweaker))

            '//make sure the velocity does not exceed the max
            speed = Math.Min(speed, m_pVehicle.MaxSpeed())

            '//from here proceed just like Seek except we don't need to normalize 
            '//the ToTarget vector because we have already gone to the trouble
            '//of calculating its length: dist. 
            Dim DesiredVelocity As Vector2D = ToTarget.Mutiply(speed).Divided(dist)

            Return DesiredVelocity.Minus(m_pVehicle.Velocity())
        End If

        Return New Vector2D(0, 0)

    End Function

    '//this behavior predicts where an agent will be in time T and seeks
    '//towards that point to intercept it.
    '//------------------------------ Pursuit ---------------------------------
    '//
    '//  this behavior creates a force that steers the agent towards the 
    '//  evader
    '//------------------------------------------------------------------------
    Private Function Pursuit(ByVal evader As Vehicle) As Vector2D
        '//if the evader is ahead and facing the agent then we can just seek
        '//for the evader's current position.
        Dim ToEvader As Vector2D = evader.Pos().Minus(m_pVehicle.Pos())

        Dim RelativeHeading As Double = m_pVehicle.Heading().Dot(evader.Heading())

        If (ToEvader.Dot(m_pVehicle.Heading()) > 0) And (RelativeHeading < -0.95) Then   '  //acos(0.95)=18 degs
            Return Seek(evader.Pos())
        End If

        '//Not considered ahead so we predict where the evader will be.

        '//the lookahead time is propotional to the distance between the evader
        '//and the pursuer; and is inversely proportional to the sum of the
        '//agent's velocities
        Dim LookAheadTime As Double = ToEvader.Length() / (m_pVehicle.MaxSpeed() + evader.Speed())

        '//now seek to the predicted future position of the evader
        Return Seek(evader.Pos().Plus(evader.Velocity().Mutiply(LookAheadTime)))
    End Function

    '//this behavior maintains a position, in the direction of offset
    '//from the target vehicle
    '//------------------------- Offset Pursuit -------------------------------
    '//
    '//  Produces a steering force that keeps a vehicle at a specified offset
    '//  from a leader vehicle
    '//------------------------------------------------------------------------
    Private Function OffsetPursuit(ByVal leader As Vehicle, ByVal offset As Vector2D) As Vector2D
        '//calculate the offset's position in world space

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合久久中文字幕| 久久综合资源网| 91精品一区二区三区久久久久久| 亚洲少妇最新在线视频| 天天操天天干天天综合网| 岛国一区二区在线观看| 欧美成人精品福利| 一二三四区精品视频| 国产·精品毛片| 26uuu亚洲| 久久成人av少妇免费| av爱爱亚洲一区| 亚洲国产高清aⅴ视频| 狠狠色狠狠色合久久伊人| 欧美巨大另类极品videosbest| 亚洲色欲色欲www| 成人免费毛片高清视频| 久久综合久色欧美综合狠狠| 日本最新不卡在线| 欧美丰满高潮xxxx喷水动漫| 天堂午夜影视日韩欧美一区二区| 99久久精品国产一区二区三区| 久久精品免费在线观看| 国产精品一区不卡| 久久精品无码一区二区三区| 激情综合色综合久久综合| 日韩三级av在线播放| 毛片av一区二区| 欧美一区二区三区视频| 日本不卡视频在线| 精品乱码亚洲一区二区不卡| 看电影不卡的网站| 欧美成人vps| 国产成人精品免费一区二区| 欧美国产日韩a欧美在线观看| 国产麻豆精品久久一二三| 久久老女人爱爱| 成人黄色免费短视频| 日韩理论在线观看| 欧美专区日韩专区| 午夜精品123| 91麻豆精品国产91久久久资源速度| 肉色丝袜一区二区| 欧美精品一区二区三区一线天视频 | 99久久精品免费看| 亚洲卡通欧美制服中文| 欧美另类变人与禽xxxxx| 日韩高清在线一区| 国产欧美一区视频| 色婷婷精品大在线视频 | 欧美疯狂做受xxxx富婆| 精品一区二区三区免费播放| 国产人成亚洲第一网站在线播放| 97se狠狠狠综合亚洲狠狠| 一区二区三国产精华液| 日韩情涩欧美日韩视频| av不卡免费电影| 日韩精品成人一区二区三区| 国产女主播视频一区二区| 99riav久久精品riav| 免费av成人在线| 中文字幕一区二区5566日韩| 91精品国产综合久久精品app | 色综合色狠狠天天综合色| 亚洲123区在线观看| 久久综合九色综合97婷婷| 色哟哟一区二区三区| 久久精品国产精品亚洲精品| 亚洲欧美色综合| 日韩欧美国产一区二区在线播放| 成人激情免费电影网址| 免费在线观看日韩欧美| 成人欧美一区二区三区视频网页| 日韩一区二区三区免费看| 色婷婷av一区二区三区大白胸| 久久激情五月婷婷| 亚洲午夜私人影院| 1区2区3区国产精品| 精品成a人在线观看| 在线播放/欧美激情| 99免费精品在线| 国产精品99久久不卡二区| 亚洲国产欧美在线人成| 国产精品盗摄一区二区三区| 欧美成人免费网站| 91精品婷婷国产综合久久 | 日韩欧美国产精品一区| 91免费国产在线观看| 国产aⅴ综合色| 国产精品综合在线视频| 美脚の诱脚舐め脚责91| 婷婷激情综合网| 亚洲美女一区二区三区| 亚洲欧洲色图综合| 国产欧美日韩三级| 久久人人97超碰com| 精品日韩在线观看| 精品国产一区二区三区忘忧草| 欧美绝品在线观看成人午夜影视| 色综合久久天天| 99精品视频免费在线观看| 成人免费视频一区| 丁香天五香天堂综合| 国产精品资源在线看| 国产乱妇无码大片在线观看| 精品一区二区日韩| 激情六月婷婷综合| 国产在线视视频有精品| 国产伦精一区二区三区| 国产一区视频网站| 国产a视频精品免费观看| 成人亚洲精品久久久久软件| 国产乱码精品一区二区三区av | 免费人成在线不卡| 麻豆91小视频| 激情伊人五月天久久综合| 精品综合免费视频观看| 精品一区二区影视| 国产成人激情av| 波多野结衣中文字幕一区二区三区| 成人动漫一区二区在线| 91亚洲永久精品| 在线不卡中文字幕播放| 日韩欧美亚洲国产精品字幕久久久| 精品三级在线看| 国产精品初高中害羞小美女文| 自拍av一区二区三区| 一区二区三区不卡在线观看| 亚洲综合成人在线视频| 午夜精品福利一区二区三区av| 久久精品国产一区二区| 成人黄色777网| 欧美日韩成人在线一区| 精品卡一卡二卡三卡四在线| 国产精品久久精品日日| 一区二区三区免费观看| 美女mm1313爽爽久久久蜜臀| 国产福利视频一区二区三区| 色婷婷精品久久二区二区蜜臀av| 3751色影院一区二区三区| 久久精品人人做| 一区二区三国产精华液| 久久av中文字幕片| 99亚偷拍自图区亚洲| 制服丝袜av成人在线看| 久久精品一区二区三区四区| 一片黄亚洲嫩模| 国产精品一区二区三区99| 在线精品视频小说1| 久久久www免费人成精品| 亚洲精品乱码久久久久久| 久久er99热精品一区二区| 不卡电影一区二区三区| 日韩精品一区二区三区视频播放| 国产精品二三区| 精品亚洲成a人| 欧美中文字幕一区二区三区| 国产亚洲欧洲一区高清在线观看| 性欧美疯狂xxxxbbbb| 不卡免费追剧大全电视剧网站| 欧美一区在线视频| 亚洲精品第1页| 国产成人精品在线看| 91精品国产综合久久久蜜臀粉嫩 | 日韩欧美在线观看一区二区三区| 中文字幕一区三区| 久久99久久精品欧美| 在线视频你懂得一区二区三区| 国产亚洲欧美色| 久久国产生活片100| 欧美性三三影院| 亚洲图片另类小说| 狠狠久久亚洲欧美| 337p亚洲精品色噜噜| 亚洲在线视频免费观看| 不卡区在线中文字幕| 国产欧美一区在线| 国内精品不卡在线| 精品精品欲导航| 日产精品久久久久久久性色| 欧美三级欧美一级| 亚洲免费av网站| 色婷婷综合五月| 17c精品麻豆一区二区免费| 高清久久久久久| 国产亚洲女人久久久久毛片| 狠狠狠色丁香婷婷综合激情| 日韩三级视频中文字幕| 蜜臀精品一区二区三区在线观看| 欧美乱熟臀69xxxxxx| 亚洲成av人片在线观看无码| 91国偷自产一区二区开放时间 | 国产高清成人在线| 久久婷婷一区二区三区| 国内精品久久久久影院一蜜桃| 欧美一区二区三区在线| 免费高清视频精品| 日韩精品一区二区三区视频播放 | 日韩毛片精品高清免费| 99在线视频精品|