Sky raft hovering over ocean

mspring

Awards

Give this entry an award

Files

File Uploader Date
sky_pirates_01.jpg
Sky raft hovering over ocean
mspring 2007/04/02 04:34

Diary Entries

Sky Pirates

I've gotten started on a game idea that revolves around pirates and airships. The player begins on the ground and pilots a sky raft toward a rendezvous with a pirate airship hovering high overhead. Along the way, the player attempts to collect treasure-filled barrels and chests suspended in air by balloons. Posted a screenshoot of a very basic sky raft.

Add a comment

Day 1

Spent my first day implementing texture mapping and a skybox, and then working on the rendering of the sky raft. (I'm using gluQuadrics and GL quads to draw the sky raft.) Here's an updated screenshot of the sky raft hovering over the ocean.

5 comments

Request for help with 3D vector math

I can't seem to get the steering for my ship to work right. Here's the problem:
  1. I want to use glRotate() to rotate the ship around the y-axis a certain number of degrees so that the ship faces the direction (in the x-z plane) it's traveling.
  2. I have two vectors: the direction vector represents the direction I'm currently going, and the goal vector represents the direction I want to go.
  3. I want to calculate the angle (in degrees) between the two vectors. This is the angle I need to rotate the ship.
Here's how I'm doing the calculation:
   old_direction = direction.normalize()
   direction = goal.normalize()
   angle = math.acos(old_direction.dot(direction)) * (180.0 / 3.1415927)

   if steer_left:
      rot.y += angle * -1
   else:
      rot.y += angle

   glRotate(rot.y, 0, 1, 0)
   # Draw the ship
When I do this, the rotatation of the ship lags behind the direction it's actually moving. Any ideas about what I'm doing wrong?

8 comments