Adding parent parameter causes entity to disappear

Archives Forums/Blitz3D SDK Programming/Adding parent parameter causes entity to disappear

cimtaurus(Posted 2007) [#1]
when adding the parent optional parameter to any entity at creation OR when using EntityParent I lose the child entity.

For example
dim sun as integer = CreateSphere(64)
ScaleEntity(sun,10,10,10)
PositionEntity(sun, 0,0,10)
dim earth as integer = CreateSphere(64,sun)
PositionEntity(earth, 0,0,100)

If I run this the erath sphere does not show on the screen.
However, if I remove the parent parameter and run it the earth sphere appears normally.

Any ideas an what I may be doing wrong?


GfK(Posted 2007) [#2]
I suspect, if its the same as Blitz3D, your earth is beyond the camera range.

I'm pretty sure that because your sun object is scaled up x10, all positionentity calls are scaled by a factor of 10, too. Its been ages since I did any Blitz3D stuff so I could be slightly incorrect on this, but try increasing your camera range. I think it defaults to 1000, so change it to 2000.


cimtaurus(Posted 2007) [#3]
that must have been it.
I used changed the code and it worked

If I position the earth entity and then call EntityParent() the earth entity retains its global positioning.


Thanks for the tip


MCP(Posted 2007) [#4]
cimtaurus - you could also have used PositionEntity(earth,0,0,100,1) which would have specified your coordinates in unscaled world coordinates.

Cheers,

Roy