I would prefer 2, since you don't have to do anything after placing the camera
under the TransformGroup of the cube. Use this stucture

TG1 - cube
|_____TG2 _ camera

with TG1 you change the position of the cube (+ inherently also the camera).
Use TG2 to set the position of the camera relative to the cube.

"Michael P. McCutcheon" schrieb:

> I'm trying to figure out what is the best way to move the camera so that it
> "follows" the cube I have that is flying though space.  By follow, I don't
> mean just look at, but follow in the sence that it is like a chase plane.
> (I've already figured out how to "point" the camera to my object using
> lookAt method).
>
> I see two possible ways to do this, but don't know what is best.
>
> 1) since the camera is contained within a TransformGroup, just get the
> coords of the cube and use an offset and place the camera near the object
> every frame.
>
> 2) do something with the branchgroups...moving the camera into another
> branchgroup so that it automatically follows the cube.
>
> Which of these approaches is better?
>
> It seems like you have to define a bunch of BranchGroups for 2 to work
> properly...I keep getting these exceptions having to do with access:
>
> javax.media.j3d.RestrictedAccessException: Cannot get the parent of a live
> or compiled node
>
> Anyway, 1 seems simple, but 2 seems like it could be better for some reason.
>
> Any thoughts?
>
> Mike
>
> p.s. I'm just learning Java3D.
>
> ===========================================================================
> 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