thanks! Would you mind posting some specs for the computer (and video
card) and browser you are running it on? I had a problem when I first
uploaded it, but restarting my browser fixed it. As for the controls-
yeah not 100% perfected yet. The way it works is y value of the mouse
controls nose up/down and mouse x controls roll. So like to do a hard
bank you first roll and then "pull through" by moving the mouse up
some. The nose actually pretty much follows the pointer. Also you can
do things that would actually make you crash like an outside roll 500
feet off the ground. That will be dealt with soon. Just wanted to show
the UV scaling terrain system mostly.

I'm not posting the source yet as it's a mess from all the experiments
I did and I'm still working on more features. The core of it is to
make a 20,000 by 20,000 plane and texture it with something that looks
sandy/rocky. I set repeat true in the material. Then I added a
TerrainDiffuseMethod to the material and used a setSplattingLayer on
it with a trees texture and a perlinNoise bitmapData as the alpha
mask. Also added a FogMethod with fogDistance 8000 to give a "off in
the distance" look to the plane edge.

I made a fly() function which is called each frame. The F-16 is over
the origin at y=500 and can rotate but it doesn't actually move. I use
roll and pitch off the mouse coordinates to rotate the F-16 and get
then get its vectors with Matrix3DUtils.getForward and
Matrix3DUtils.getUp. Then I used the scaleU, scaleV, and offsetU, and
offsetV values of the terrain material to make the motion effect. The
scrolling motion is just done by assigning material.offsetU +=
long_vector.x, material.offsetV -= long_vector.z. You have to multiply
those values by a small coefficient or it looks like the plane is
moving 10,000 miles per hour.

The altitude effect is trickier since scaling UV changes things from
the corner of the plane. Without offsetting the UV values at the same
time it looks you are flying backwards diagonally. So for that you
have to scale the UV off the y component of the F-16 forward vector
and offset it right after by 1/2 the value you scaled. Only took me 2
days to figure that one out ; ) That looks like

material.scaleU += long_vector.y * increment;
material.scaleV += long_vector.y * increment;
material.offsetU -= long_vector.y * (increment/2);
material.offsetV -= long_vector.y * (increment/2);

It's definitely an unusual way to do it, but it's the best way I've
found to keep the horizon looking right without having to use a
300,000 X 300,000 tiled system.

On Jun 13, 10:56 pm, thinkingarden <thinkingar...@gmail.com> wrote:
> and the plane is hard to control , by the way ,  could you please
> share with us your source code as a tutorial ?
>
> thank you very much  !

Reply via email to