realbasic-games
[Top] [All Lists]

Re: 3D Ball

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: 3D Ball
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Tue, 20 Sep 2005 08:39:46 -0600
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <CD020872-E096-4573-95F2-38F1773C77B5 at nosrelo dot it>
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>

<Prev in Thread] Current Thread [Next in Thread>