blit(back, buffer, 320-70, 330, 320-70, 330, 140, 30);
textprintf centre ex(buffer,font,320,330,WHITE,-1,"COUNTER %d", counter);
textprintf centre ex(buffer,font,320,340,WHITE,-1,"FRAMERATE %d", framerate);
textprintf centre ex(buffer,font,320,350,WHITE,-1,"RESTING %d", rested);
Thực hành:
Xây dựng một tiến trình điều khiển đối tượng di chuyển và dừng lại, đổi hướng theo thời gian.
- Yêu cầu SV chuẩn bị:
- Đọc chương 11 trong [1], chương 5 trong [4]
- Đọc các phần tương ứng trong tài liệu [5].
- Chú ý nghe giảng.
- Tích cực tham gia phát biểu ý kiến
Bài giảng 10: Cơ chế vật lý trong game.:
Tiết thứ:30-33 Tuần thứ: 10+11
- Mục đích, yêu cầu:
• Nắm được các nguyên lý vật lý dùng để xây dựng quỹ đạo chuyển động, các cơ chế va chạm cháy nổ cho các đối tượng trong game.
- Hình thức tổ chức dạy học: Lý thuyết, tự học, tự nghiên cứu
- Thời gian: Lý thuyết: 4t; Tự học, tự nghiên cứu: 12t
- Địa điểm: Giảng đường do P2 phân công.
- Nội dung chính:
10.1 Physics Will Keep Your Games from Looking Fake
If you’re looking for realism in a flight simulator, then this game is the way to go. The experience is breathtaking as you can almost feel the plane’s reaction to its surroundings.
10.2 Coordinate Systems and Frames of Reference
10.2.1 The Cartesian coordinate system
The Cartesian coordinate system defines the location of an object by specifying the x, y, and z location of the object.
10.2.2 The sphericalcoordinate system
The spherical coordinate system defines the position of an object by a distance r from an origin and two angles 𝜃 and 𝜑
10.2.3 Matrices
a = 4x+ y−3z
b=−7x−2y+5z
c =3x+3y+z
10.2.4 Matrix Multiplication
10.2.5 Rotation Matrices
10.2 Basic Newtonian Mechanics
10.2.1 Force Vector
10.2.2 Types of Forces
10.2.2.1Gravitational Force
class GameUpdater implements ActionListener {
public void actionPerformed(ActionEvent event) {
// Update the time and compute the new position
// of the box and ball.
double timeIncrement = 0.05;
time += timeIncrement;
boxLocation = boxVelocity*time;
if ( dropped ) {
dropTime += timeIncrement;
ballAltitude =
initialAltitude - 0.5*g*dropTime*dropTime;
}
10.2.2.2Friction
// This ActionListener is called by the Timer
class GameUpdater implements ActionListener {
public void actionPerformed(ActionEvent event) {
// Update the time and compute the new position
// of the disk.
time += 0.05;
// Compute the current velocity of the disk.
Chia sẻ với bạn bè của bạn: |