I have got several trees where the leaves I thought I made them to be children in blender
the 3ds models show the bark and inside the bark the child objects ie leaves and branches
but when I import into agk with loadobjectwithchildren it reports 0 children
the plan was to use a different texture for the children than the primary object
There must be something else I have to do with the model export but im not sure as when I load
them back into blender it still shows the children but nothing in AGK
the code im using
// Project: trees
// Created: 2019-04-18
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "trees" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
#constant KEY_LEFT 37
#constant KEY_RIGHT 39
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
trunk as integer[11]
for num = 1 to 11
trunk[num]=loadImage("trunk_skin_"+str(num)+".png")
next num
leaves as integer [16]
for num = 1 to 16
leaves[num]=loadImage("leaves_"+str(num)+".png")
next num
tree as integer[20]
for num = 1 to 20
tree[num]=LoadObjectWithChildren("tree_"+str(num)+".3ds")
SetObjectImage(tree[num],trunk[Random(1,11)],0)
for i=1 to GetObjectNumChildren(tree[num])
SetObjectImage(GetObjectChildID(tree[num], i), leaves[random(1,16)], 0)
next
SetObjectTransparency(tree[num],1)
SetObjectScalePermanent(tree[num],4,4,4)
SetObjectVisible(tree[num],0)
RotateObjectLocalX(tree[num],90)
next num
visTree = 1
do
//this code should show children for each tree but only prints 0
for num=1 to 20
print(GetObjectNumChildren(tree[num]))
next num
if GetRawKeyPressed(KEY_LEFT)
SetObjectVisible(tree[visTree],0)
if visTree>1
dec visTree,1
else
visTree=20
endif
endif
if GetRawKeyPressed(KEY_RIGHT)
SetObjectVisible(tree[visTree],0)
if visTree<20
inc visTree,1
else
visTree=1
endif
endif
SetObjectVisible(tree[visTree],1)
Print( ScreenFPS() )
Sync()
loop