Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / dbInstanceObject vs dbCloneObject

Author
Message
atomic knights
16
Years of Service
User Offline
Joined: 12th Apr 2008
Location: On my laptop
Posted: 25th Jan 2009 18:38
I am creating a string of fences of which there are 3 styles. I create and place the 3 versions then run a loop randomly picking a style and placing it. From the documentation, dbInstanceObject was the way to go

When I run the code with dbCloneObject it works fine. When I use dbInstanceObject, I only get my 3 original fence pieces.

Any ideas ?

I am posting the code but it is probably pretty useless without the models (they are from fpsc model pack 11). MakeObject() is my own function that returns a unique object number.

Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 25th Jan 2009 22:29
Of course, dbInstanceObject shares the original object's vertex and texture(?) data. dbCloneObject does not.
atomic knights
16
Years of Service
User Offline
Joined: 12th Apr 2008
Location: On my laptop
Posted: 26th Jan 2009 00:06
???? Of course what? From what I read, dbInstanceObject is exactly for what I am doing, duplicating static objects. I don't delete the originals. Texturing isn't the issue, I would see an untextured object.

Is there something constructive you are trying to say that I am missing?
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 26th Jan 2009 00:29
You get your original style because the style is dependent on the original object.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 26th Jan 2009 00:38 Edited at: 26th Jan 2009 00:50
Try this (I hope I remembered this information correctly)


I suspect your instanced part of the fence is actually there, just it is so huge that you are not seeing it in the view area.

EDIT: Sorry I just woke up and am still half sleeping.
changed the code fragment to reflect instancing rather than cloning.
atomic knights
16
Years of Service
User Offline
Joined: 12th Apr 2008
Location: On my laptop
Posted: 26th Jan 2009 05:57 Edited at: 26th Jan 2009 05:59
that was it!!! great. As a re-cap, dbCloneObject worked fine but when dbInstanceObject was used, the object needed to be re-scaled.

THe following code worked fine:



but when dbInstanceObject was used, the instance had to be re-scaled:



I wonder if this is a bug? You would expect that all the properties copied as a clone would be copied as an instance.

thanks again.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 26th Jan 2009 07:08 Edited at: 26th Jan 2009 07:12
I have no idea as to it being a BUG or not.
I just know that there are many unusual happenings when one tries to scale objects.
In all my projects, I am now standardizing to 1 Game Unit = 1 Meter .
All my media is created with the assumption of that scale.
No scaling gets done within the game itself.

I am trying to save myself any problems of a similar nature to what you have just come across.

By the way, I love you original code sample, you are obviously thinking outside of the box in the way you do things.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Jan 2009 18:21
Clone copies the whole object.

Instance creates a new object but uses the mesh of another - this excludes scale/position/rotation data.

Login to post a reply

Server time is: 2024-11-25 13:30:51
Your offset time is: 2024-11-25 13:30:51