Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

2D Displays in a RB3D Space (Real Studio games Mailinglist archive)

Back to the thread list
Previous thread: need alpha testers for Renegades
Next thread: Background Music


[ANN] Preview of RBD 2.4   -   Marc Zeedar
  2D Displays in a RB3D Space   -   Greg Gillis
   Re: 2D Displays in a RB3D Space   -   Lars Jensen
   Re: 2D Displays in a RB3D Space   -   Joseph J. Strout
    Re: 2D Displays in a RB3D Space   -   Greg Gillis
     Re: 2D Displays in a RB3D Space   -   Asher Dunn

2D Displays in a RB3D Space
Date: 09.01.05 22:34 (Sun, 9 Jan 2005 16:34:05 -0500)
From: Greg Gillis
I've been dabbling with RB3D for the first time, and I must say it's
pretty amazing how quickly you can get a little polygonal world thrown
together. I'm having a lot of fun :) That being said, I still have some
questions that Joe's FAQ and the RB documentation don't appear to
answer...

Before I try and reinvent the wheel I was wondering if anybody could
tell me what the standard way of showing 2D displays in a 3D space
might be. I'm thinking specifically of things like the player's score
or some other sort of data that would be drawn into a translucent box
and remain in a fixed position relative to the camera, such as the
bottom right corner of the screen.

I've tried setting the box's position.x, position.z, pitch, etc. to
match the camera's position and orientation each frame, which works
pretty well for my test project which has a fixed camera pitch
(three-quarter perspective). I'm just thinking that this technique
probably wouldn't work very well once you start working on a project
that involves lots of camera pitch, yaw, and roll adjustments.

I'm also a bit confused about how one would go about refreshing the
data displayed in said box. I've been doing this for each refresh as a
test:

// mStatusDisplay is the object3D that I'm using to display my
picture, p

statusDisplayCounter = statusDisplayCounter + 1
mStatusDisplay.addShapePictureWithMask p, p.mask, 200 / p.width
mStatusDisplay.shape = statusDisplayCounter

This technique appears to be rather inefficient, as I have to add a new
shape every time I want to update the score display. Is there any way
to remove a shape from an object, or should I perhaps just destroy the
object and make a new one each time I have to update the score?

Greg Gillis

Visit The Armadillo Games Home Page:
http://members.rogers.com/armadillogames
... featuring "Radiant Weirdness Zone", the "Fawn" RPG series, and
numerous armadillii...

Visit FORS YARD, A Chronological Retrospective of the Sega Genesis:
http://homepage.mac.com/greggillis

_______________________________________________
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>

Re: 2D Displays in a RB3D Space
Date: 09.01.05 23:56 (Sun, 09 Jan 2005 17:56:15 -0500)
From: Lars Jensen
> Before I try and reinvent the wheel I was wondering if anybody could
> tell me what the standard way of showing 2D displays in a 3D space
> might be.

Joe's got an example of this (with source):

http://codenautics.com/armageddon/

> I'm just thinking that this technique
> probably wouldn't work very well once you start working on a project
> that involves lots of camera pitch, yaw, and roll adjustments.

Frank's got an example of keeping stuff in front of the camera:

http://developer.chaoticbox.com/ (see Overlay3D)

> Is there any way to remove a shape from an object...?

Alas, no example because it can't currently be done. But I've got a feature
request for it that you could sign onto:

http://www.realsoftware.com/feedback/viewreport.php?reportid=gwdwhiki

Or you could have an object that a shape for each numeral 0-9, and Clone it
for each digit of your score. (Maybe that's what Joe does in Armageddon -- I
haven't looked...)

lj

_______________________________________________
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>

Re: 2D Displays in a RB3D Space
Date: 10.01.05 00:39 (Sun, 9 Jan 2005 17:39:21 -0600)
From: Joseph J. Strout
At 4:34 PM -0500 1/9/05, Greg Gillis wrote:

>Before I try and reinvent the wheel I was wondering if anybody could
>tell me what the standard way of showing 2D displays in a 3D space
>might be.

Basically, create a shape with AddShapeFromPicture[WithMask], and
stick it in front of the camera, facing the camera, and usually with
.NullShader = true.

Examples can be found in several apps, including...

Armageddon: <http://www.codenautics.com/armageddon/>
Offworld: <http://www.strout.net/info/coding/rb/offworld/>

Also, Frank has a nifty little bit of code called "Overlay3D" that
does the math for you. I'm actually using this in Renegades, but it
doesn't seem to include any notes, so I can't tell you offhand
exactly where I got it... but a search of the archives should turn it
up.

>I've tried setting the box's position.x, position.z, pitch, etc. to
>match the camera's position and orientation each frame, which works
>pretty well for my test project which has a fixed camera pitch
>(three-quarter perspective).

Yes, all you have to do is set the orientation equal to the camera's
orientation, and use Object3D.LocalToWorldTransform to find the
position.

>I'm also a bit confused about how one would go about refreshing the
>data displayed in said box.

There's nothing to do except either swap to a different shape (if you
have only a limited number of shapes to display), or create a new
object.

>This technique appears to be rather inefficient, as I have to add a
>new shape every time I want to update the score display. Is there
>any way to remove a shape from an object

No...

>or should I perhaps just destroy the object and make a new one each
>time I have to update the score?

Yes.

Best,
- Joe

Re: 2D Displays in a RB3D Space
Date: 10.01.05 21:38 (Mon, 10 Jan 2005 15:38:12 -0500)
From: Greg Gillis
> Yes, all you have to do is set the orientation equal to the camera's
> orientation, and use Object3D.LocalToWorldTransform to find the
> position.

Thanks to everyone for the replies! It seems
Object3D.ObjectToWorldTransform was the part of the equation I was
missing.

I now have one more question though. If I display 2D overlays using the
method described above, I can position them relative to the camera but
not the RB3DSpace itself. This become a bit of an issue if the aspect
ratio of the game surface needs to be able to change, such as if the
game is played on a 4:3 monitor as opposed to the
somewhat-more-common-nowadays 15:9 Apple displays.

Is there any reliable method I could use to, say, put a 2D status
display box a certain distance from the right edge of the 3D surface
regardless of the surface's shape?

Greg Gillis

Visit The Armadillo Games Home Page:
http://members.rogers.com/armadillogames
... featuring "Radiant Weirdness Zone", the "Fawn" RPG series, and
numerous armadillii...

Visit FORS YARD, A Chronological Retrospective of the Sega Genesis:
http://homepage.mac.com/greggillis

_______________________________________________
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>

Re: 2D Displays in a RB3D Space
Date: 13.01.05 23:40 (Thu, 13 Jan 2005 17:40:56 -0500)
From: Asher Dunn

On Jan 10, 2005, at 3:38 PM, Greg Gillis wrote:

> Is there any reliable method I could use to, say, put a 2D status
> display box a certain distance from the right edge of the 3D surface
> regardless of the surface's shape?

I believe the Overlay2D classes can do this.

Asher Dunn
--------------------------------------------------------
President and Head Developer of Fireye Software
<http://www.fireyesoftware.com/>
AIM and Yahoo: fireye7517

_______________________________________________
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>