First, I haven't done this in Java yet, but the approach I used in other 3D
applications is fairly simple, and should be easy to implement in Java3D.
Assuming "UP" is the Y-axis, get the x and z locations of the moving object
(avatar, cruse missle etc...) then find the coorisponding y value in the terrain
object at those same x-z coordinates, then offset that value for whatever
distance above the terrain you want the object to be. Now just take that value
and plug it into the y position of your avatar.

Now to speed it up, you may want to implement some type of data structure to
hold the terrain coordinates making it easier to search through the coordinates.
But this isn't necissary if your terrain isn't too detailed.

If you need me to take a stab at it, just let me know, I may even try it just
for giggles sometime.

Matthew Flagg wrote:

> I don't think this question has been answered on the list.  If it has then I
> missed that post.  Either way I would be interested in knowing how to
> implement terrain following.  Thanks.
>
> > -----Original Message-----
> > From: The Casteels [SMTP:[EMAIL PROTECTED]]
> > Sent: Saturday, February 05, 2000 9:01 AM
> > To:   [EMAIL PROTECTED]
> > Subject:      Re: [JAVA3D] How to set up the terrain following in java 3d
> >
> > This message uses a character set that is not supported by the Internet
> > Mail Service.  To view the original message content,  open the attached
> > message. If the text doesn't display correctly, save the attachment to
> > disk, and then open it using a viewer that can display the original
> > character set. << File: message.txt >>
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to