zoukankan      html  css  js  c++  java
  • dead reckoning variation

    Targeting

    A target is a structure of information that describes the state, and change of state, of an object that exists in a remote person's instance of a game.

    When you fire your laser, you send a packet of data to the server saying that

    1. You shot the laser,
    2. It was shot at some position in space (ox,oy) and
    3. that it's moving straight up.

     

    for each frame {

      target.x_velocity = target.x_velocity + target.x_acceleration;

      target.y_velocity = target.y_velocity + target.y_acceleration;

      target.z_velocity = target.z_velocity + target.z_acceleration;

     

      target.x_position = target.x_position + target.x_velocity;

      target.y_position = target.y_position + target.y_velocity;

      target.z_position = target.z_position + target.z_velocity;

        smooth();

     

    }

    smooth(){

      laser.x = (laser.x + target.x_position) / 2;

      laser.y = (laser.y + target.y_position) / 2;

      laser.z = (laser.z + target.z_position) / 2;

    }

     

    smooth2(){

      laser.x = (laser.x * 99 + target.x_position) / 100;

      laser.y = (laser.y * 99 + target.y_position) / 100;

      laser.z = (laser.z * 99 + target.z_position) / 100;

    }

  • 相关阅读:
    python小记(4)
    python小记(3)
    python小记(2)
    python小记(1)
    Linux学习
    plist文件的 偏好设置 存储与读取 自定义对象归档
    控制器创建的三种方式
    IOS应用启动过程
    pch文件中自定义log
    textLabel辅助试图及toolBar创建使用
  • 原文地址:https://www.cnblogs.com/lightlfyan/p/4203885.html
Copyright © 2011-2022 走看看