At 3:01 PM +0200 9/20/05, Niccolo Zapponi wrote:
I'm trying to make a 3D ball moving into a space where a tile terrain is.
I made the tile terrain and put a keydown event saying that if
up-arrow is pressed, the ball and the camera go forward of 100.
Same for backwards
But I cannot make it turn left or right because i have no idea on
how to do it!!! The only thing to remember for helping me is that
the camera must always show the ball in the center... (At the begin
the camera Z position is 200 behind the ball position.)
This isn't too hard; use ball.Yaw to make the ball turn left or
right. (Or if you want it to move left or right without turning, you
can just add an appropriate value to its X position.)
To make the camera maintain a constant position relative to the ball,
you can just call ball.ObjectToWorldTransform. Pass in a
ball-relative position like <0,0,-100>, and it will give you back
that same position in world coordinates, which is where you want to
set the camera.
Also check out the Rb3D FAQ, which has some functions you may find
handy like PointObjectAt (which you can use to make the camera look
at the ball no matter where they are).
<http://www.strout.net/info/coding/rb/>
Sounds like a neat app! Please keep us posted on your progress.
Best,
- Joe
--
Joe Strout REAL Software, Inc.
Vote for REALbasic (twice!) in the LinuxWorld Reader's Choice Awards:
http://linux.sys-con.com/general/readerschoice.htm
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|