示例#1
0
    // Update is called once per frame
    void Update()
    {
        Vector3 accel = wander.GetSteering();

        steeringBasics.Steer(accel);
        steeringBasics.LookWhereYoureGoing();
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        // 加速度(有碰撞 就避免碰撞)
        Vector3 accel = colAvoid.GetSteering(colAvoidSensor.targets);

        // 没有任何碰撞的时候就  漫游
        if (accel.magnitude < 0.005f)
        {
            accel = wander.GetSteering();
        }

        // 速度
        steeringBasics.Steer(accel);
        // 朝向
        steeringBasics.LookWhereYoureGoing();
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        Vector3 accel = Vector3.zero;

        // 集群加速度
        accel += cohesion.GetSteering(sensor.targets) * cohesionWeight;
        // 分隔加速度
        accel += separation.GetSteering(sensor.targets) * separationWeight;
        // 速度匹配加速度
        accel += velocityMatch.GetSteering(sensor.targets) * velocityMatchWeight;

        // 如果没有那些 影响, 就漫游好了
        if (accel.magnitude < 0.005f)
        {
            accel = wander.GetSteering();
        }

        // 设置刚体速度  和  朝向
        steeringBasics.Steer(accel);
        steeringBasics.LookWhereYoureGoing();
    }