|
|
|
Aug. 5, 2008
Faking Object Shadows -- Great Camera Setup
|
|
I received a comment asking how I did the shadows and camera setup in my Car Game.
Shadows: The shadows are are not actual shadows (you have to fake the shape) but are very easy to make.
1. In the mesh that you want to have the shadow for, make a plane, subdivide it (if you need to), and make it the right shape for your object.
2. Then, in the 'Editing' buttons (F9) and in the 'Texture Face' panel, set the faces to 'shadow'. Now they will drop strait down the global Z axis and set on the next face that they hit when you start the game engine.
3. From what I can remember, you need to make sure the face is even, in the 'z' direction, with the object center. To get the right effect, you should also add a semi-transparent material to the shadow faces.
Camera Setup: This is a little more complicated, but all it is, is a bunch of empties and a small script.
Here is a '.blend' file with just the camera setup: Camera Setup.blend. (right click, select 'Save target/link as')
For illustration purposes:

Empty #1: The Camera!
Empty #2: The parent of the camera. The script sets the location of this empty to the location of Empty #3.
Empty #3: This empty is independent. It always tracks Empty #4, and moves toward it at a certain speed. The speed is defined in the script using a certain formula which makes it faster when it is farther away and slower when it is closer.
Empty #4: This is the main camera position. It sets it's location to the location of one of Empty #6's ray's collision points or the location of Empty #5 if there is no collision. (was that understandable?)
Empty #5: The location of Empty #4 when there is no collision. It has a location ipo so that it will match the distances of the collision rays from Empty #6 when you change the camera distance during the game by pushing 'c'.
Empty #6: Parent this to the object you want to follow. This also sends the rays that determine camera collisions.
On the slight chance that you were able to understand that (I'm not a very clear writer most of the time), you now have the basic functions of the setup. |
| •
Post A Comment! •
Send to a Friend!
|
| |
|
|
|
|
|
Aug. 8, 2008 - some more questions
For the shadow though, I am having some trouble, every time I make another face, then in the texface tab, in the edit buttons, I deselect collision, and select shadow. Then when I run the game, the car just flies forward, like it is detecting a collision, and trying to escape it. I am putting the face in the vehicle mesh, is this correct? I amd running blender 2.46 on windows XP. Also, I have another question, I have a character that doesn't get shaded for some reason. When I set a face of the character to use light, it works, but it only does it to the Active face, and not the selected faces. Is there anyway to set all the selected faces at once? Sorry to bug you again...
-Andrew