keeping ALL attributes when parenting

Blitz3D Forums/Blitz3D Beginners Area/keeping ALL attributes when parenting

Steven Noyce(Posted 2006) [#1]
I am trying to have a function that creates and parents sprites to many different objects. It works fine on all objects except for the terrain, because the terrain is scaled a lot in the y direction, so the sprites are way streched out when I parent them to the terrain. Is there any way to have it so an object retains ALL attributes when I parent it?


Stevie G(Posted 2006) [#2]
You could create a pivot, parent your terrain entity to this pivot & scale the terrain. Then parent your sprites to the same pivot which is unscaled so wont affect children.

Stevie


Steven Noyce(Posted 2006) [#3]
Thanks! Good idea, I will go try it!

Any other good ideas still welcome tho, I always like to get different outlooks on things!


jfk EO-11110(Posted 2006) [#4]
correct me if I'm wrong, I thought a child will use the parents properties only when it is already parented when the attributes are set. So when you parent it to the entity after all attributes are set, it should not affect the child.
But as I said, I'm not sure if this was "fixed" in one of the recent releases or if it still works.


Steven Noyce(Posted 2006) [#5]
Well, that is what I orrigonally thought also, and that is exactly what I want, but this is not the case. I think this might be a bug. It is acting very strangly. I have been making simple programs to see what is wrong with this. It seems that it only scales the child if you have used aligntovector on the child. Here is a simple program to ilustrate.
Graphics3D 640,480
SetBuffer BackBuffer()

camera=CreateCamera()

parent=CreateSphere()
ScaleEntity parent,2,4,1

child=CreateSphere()
AlignToVector child,.000001,.000001,.000001,3
PositionEntity child,0,0,5
EntityParent child,parent,1

While Not KeyDown(1)

UpdateWorld
RenderWorld
Flip
Wend
End



DJWoodgate(Posted 2006) [#6]
I think Entityparent with the global flag set (default) is trying to preserve the existing size of the object by rescaling it into the local space. This gets weird when the local space is not uniformly scaled and the object is not axially aligned. You would see the same effect by turning or rotating the child.

The docs fail to mention this of course.


Steven Noyce(Posted 2006) [#7]
Any ideas of how to get around it?