relatively positioning a common object

edited February 2011 in Help request
hey,
I have several different objects, that all have the same size. Now I would like to position an image relatively to each of them.

So this is what I did:
[Someobject1]
Position = (0,0,0)
Graphic = Samegraphic1
ChildList = CommonObject

[Someobject1]
Position = (100,0,0)
Graphic = Samegraphic1
ChildList = CommonObject

[CommonObject]
Graphic = CommonObjectGraphic
Position = (120,10,0)
What I expect is:
Both Someobject1 and Someobject1 have a CommonObject instance positioned relatively to them. However this will only work for the first object that refers to the CommonObject. Is this the way the ChildList is intended?

Now I tried to define another object that has it's own graphic. if both textures will refer to the same file I got the same behaviour. only if I refer to another image file the whole thing will work as I want it to.

So the following will only show CommonObject1 but not CommonObject2.
[Someobject1]
Position = (0,0,0)
Graphic = Samegraphic1
ChildList = CommonObject1

[Someobject1]
Position = (100,0,0)
Graphic = Samegraphic1
ChildList = CommonObject2

[CommonObject1]
Graphic = CommonObjectGraphic
Position = (120,10,0)

[CommonObjectGraphic]
Texture = somefile.png

[CommonObject2]
Graphic = CommonObjectGraphic2
Position = (120,10,0)

[CommonObjectGraphic2]
Texture = somefile.png

Whereas the following will not only show CommonObject1 but also CommonObject2.
[Someobject1]
Position = (0,0,0)
Graphic = Samegraphic1
ChildList = CommonObject1

[Someobject1]
Position = (100,0,0)
Graphic = Samegraphic1
ChildList = CommonObject2

[CommonObject1]
Graphic = CommonObjectGraphic
Position = (120,10,0)

[CommonObjectGraphic]
Texture = somefile.png

[CommonObject2]
Graphic = CommonObjectGraphic2
Position = (120,10,0)

[CommonObjectGraphic2]
Texture = someOTHERfile.png

I don't know if this is a bug, or I'm misusing the ChildList.

Comments

  • edited February 2011
    This is quite interesting. Everything appears correct to my eye, including your first attempt and your expectations. Personally I'd file this under 'bug' for now. I'll take a look at the code for handling this shortly and get back to you, if Iarwain does not beat me to it. (Or correct my assumptions that this is incorrect behaviour.)
  • edited February 2011
    First of all, I assume it's a typo that you have Someobject1 defined twice, isn't it?

    Could you post a screenshot of what you get as the test I did here looks like it's working as it should?
  • edited February 2011
    Could it be because your objects are too big and that they would overlap the children?

    Try putting the children slightly in front of the parent by using a Z = -0.001.

    Also, you can't make any assumption on the display order except for the Z position (from smaller to bigger) as objects will get grouped in the render plugin by Z value, texture, blending, smoothing and shader combination, so that the least amount of rendering context switch will occur.
  • edited February 2011
    whoa... yeah, I got a little distracted looking at code... 13 hours later I realised I was supposed to come back -_- sorry guys!
  • edited February 2011
    ok yeah I think you're completely right about the z-ordering. I tried a negative value before, but I think it was too great, so that the objects were positioned behind the camera.

    the childlist thing must somehow effect the ordering of the objects. but true, I should only rely on the z-value for rendering.

    thanks for the help!
  • edited February 2011
    Glad it works!

    And yep, the Z value of the children is relative to the parent (no scale on Z value btw, it's just ignored). So if your parent has a absolute Z of 0.5 and your child has a Z of -0.1, it's absolute Z will be 0.4.

    One way of seeing what happens is just to turn your object transparent so it's easy to track hidden objects. Could be done directly in config or via a shader.
Sign In or Register to comment.