首页 > 其他 > 详细

dead reckoning variation

时间:2015-01-05 18:03:14      阅读:121      评论:0      收藏:0      [点我收藏+]

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;

}

dead reckoning variation

原文:http://www.cnblogs.com/lightlfyan/p/4203885.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!