tailieunhanh - Microsoft XNA Game Studio Creator’s Guide- P12
Microsoft XNA Game Studio Creator’s Guide- P12:The release of the XNA platform and specifically the ability for anyone to write Xbox 360 console games was truly a major progression in the game-programming world. Before XNA, it was simply too complicated and costly for a student, software hobbyist, or independent game developer to gain access to a decent development kit for a major console platform. | 08 MICROSOFT X N A GAME STUDIO CREATOR S GUIDE Figure 19-3 shows several rockets at various elevations on the Y axis and at different stages of flight. Over time the projectiles lose momentum and gravity pulls them to the ground. The overall effect creates a nice arcing projectile path. Game developers will often use real-world physics to create more realistic graphics effects. The physical properties that they consider may include gravity friction force velocity acceleration viscosity and much more. In case you re wondering game development companies will often implement pseudo-physics in their algorithms. As long as the effect looks correct and is efficient an approximation of the laws of physics is usually the faster and more effective alternative. After all as a simulation approaches reality it can become so complex that it loses its value. However even when the code deviates from the laws of physics realistic algorithms usually consider some portion of the real physical model. Once the launch velocity and direction have been obtained the effect of gravity can be computed and the X Y and Z positions of the projectile can be calculated over time. The X and Z positions are calculated using the same equations as the Linear Projectile algorithm to obtain the projectile s position over time Xt Xstart Vx t Zt Zstart Vz t The Arcing Projectile algorithm treats the calculation of the Y position over time as a special case that also considers gravity. Initially the projectile s velocity is powerful enough to defy gravity otherwise there would be insufficient energy to launch FIGURE 19-3 Considering the effect of gravity over time chapter 1 9 09 the projectile into the air. However over time the projectile loses its momentum and gravity becomes the strongest force on the object. This gravitational pull is defined by a constant value of acceleration g which represents the Earth s gravity. The accepted value for g equals meters second2 32 ft s2 . After the Earth s .
đang nạp các trang xem trước