At 3:58 PM -0500 2/16/05, Heinz J. Gattringer wrote:
I have been able to replace quite a lot of complex and awkward code
with few lines of convienient build in Object3D methods and
properties (mainly direction and orientation stuff) and add a lot of
niceties which would have been unthinkable in a spritesurface
(related to camera positioning and lighting). But what excites me
perhaps the most is the fact that I am getting about 2 times the
framerates I was getting on the non graphic card accelerated
spritesurface AND with better looking graphics.
Great! Glad to hear it's been worth the effort.
So here comes the first one: The main objects of my game are group3D
entities (since they include a rotating gun turret which I want to
be able to rotate and orient independently of the whole object even
if it is attached to that object).
That doesn't necessarily imply the use of a Group3D, though -- in
fact, nothing does. Group3D is only a convenience. However,
convenience may well be a good reason to use it.
To allow the player to select the different objects in the game I
was hoping to use the FindObject method of the RB3D-control together
with its Objects property (which is a Group3D as well) and the index
of that property. But the index of the RB3D-control's Objects
property seems to work only with Object3Ds, not Group3Ds.
No, that's not the case. Remember that a Group3D IsA Object3D. So,
Rb3DSpace.Objects.Item(4) may be a Group3D or it may be some other
sort of Object3D.
The funny thing is that all Group3D objects return a index of 0
(not nil, since they are the first objects I appended to the
RB3D-Space), and the next appended object3D returns it's logically
following index number.
I don't understand what you mean by "returns" -- I see the index as
something you plug into the Item accessor to look up an object, not
something you get back from some other method.
So, if I have say 5 Group3Ds and 3 Object3Ds appended to the
3DSpace, I get 5 index numbers of 0 and then correct indexes of 5,6
and 7.
Get them how? I'm still not following you. In the scene you
describe, Rb3DSpace.Objects.Item(3) is the fourth Group3D. Its index
(in the Objects group) is 3, not 0.
I have been bypassing the selection problem by getting an object3D
at the clicked on spot with the FindObject method, then comparing
the x and z coordinates of that object with those of the possible
selectable objects and thus determining the correct object.
Ow. If you're willing to do that sort of thing, you don't need
FindObject at all; it's easy to find where the user clicked on an
arbitrary plane (such as the ground plane). But that won't give you
pixel-precise clicking, which users expect. I think you should use
FindObject to get the object that was clicked, and if you need to
find the Group3D that contains it, then simply search your Group3Ds
for the one that contains it.
Or, better yet: make an Object3D subclass, which contains whatever
identifying information you want/need. For example, it may have
property values which mean "I'm the gun turret for tank #A12." Then,
once you get the result from FindObject, you can simply see if the
returned object IsA instance of your Object3D subclass. If so,
typecast it to that, and inspect its properties to see exactly what
it is and which unit it belongs to.
It works, but the dissatisfactory thing about this method is that
when the player clicks right on the gun-turrets, he gets no
selection, since the coordinates delivered then are very different
(I believe they are local to the group3D).
No, all positions are global, and BTW, if you just want the position
clicked you should be using FindPoint, not FindObject. But see above
-- the correct solution really is to use FindObject and not worry
about the point clicked at all.
P.D: Do excuse the long writing, but as I said, I am a bit excited
about this RB3D-thing.
Cool, I'm excited about your project too. Have any screen shots to share?
P.D.2: Those quaternions are really a heavy lift workout for the brain.
Heh, don't worry, soon you'll be thinking in quaternions all the time.
Best,
- Joe
--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>
_______________________________________________
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>
|