I hope somebody could help me here a little i already wasted a week in this.
I have a scene with only 3 cubes , I want to be able to assign a texture to each cube. So i Export it as .FBX and import into AGKS , then i use SetObjectImage to texture the main object Then SetObjectImageMesh to texture the second and same with the third.
But it is Not working, Or it sets one texture to both cubes or it sets to all cubes. This time SetObjectMeshImage dont give me the error that am out of range, so that lets me know 3 separate objects exist,but i can still not texture them independently.
This is my code :
// Project: RolaBola
// Created: 22-11-07
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "RolaBola" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// 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 )
SetRawMouseVisible(0)
Speed# = 1
//Load Map With Children, Ball and Street
Map = LoadObjectWithChildren("Level.fbx")
RotateObjectLocalX(Map,90)
//Load Object with its children, an object made out of different meshes
Tree = LoadObjectwithChildren("TreeX.x")
//Load Images to Texture the tree
Leaves = LoadImage("branch09.png")
Bark = LoadImage("bark02.png")
BarkNormal= LoadImage("bark02_Normal.png")
//Set UV That the Image dont repeat or go nuts on the model
SetImageWrapU(Bark,1)
SetImageWrapV(Bark,1)
SetImageWrapU(BarkNormal,1)
SetImageWrapV(BarkNormal,1)
//Color map
SetObjectColor(Map,128,128,255,1)
//position tree at center of world
SetObjectPosition(Tree,0,0,0)
//Texture Main object Tree and its children and apply normalmap
SetObjectImage(Tree,leaves,0)
SetObjectMeshImage(Tree,1,Bark,0)
SetObjectMeshNormalMap(Tree,1,BarkNormal)
SetObjectImage(Map,leaves,0)
SetObjectMeshImage(Map,1,Leaves,0)
SetObjectMeshImage(Map,2,Bark,0)
//Alphamak makes the leafs transparent, black = Transparent
SetObjectAlphaMask(Tree,1)
//ScaleObjectTree
SetObjectScale(Tree,0.02,0.02,0.02)
SetCameraPosition(1,0,0,0)
//SKy
SetSkyBoxVisible(1)
SetSkyBoxSkyColor(125,180,90)
SetSkyBoxSunSize(20,40)
//Main loop, mouse and key controls to move
do
if Getrawkeystate(87)=1
movecameralocalz(1,Speed#)
Elseif getrawkeystate(83)=1
movecameralocalZ(1,-Speed#)
endif
if Getrawkeystate(68)=1
movecameralocalX(1,Speed#)
Elseif getrawkeystate(65)=1
movecameralocalX(1,-Speed#)
endif
if getrawkeystate(27)=1
end
Endif
If GetRawKeyState(16) = 1
speed# = 3
Else
Speed# = 0.21
endif
myX# = getpointerX() - 512
myY# = getPointerY() - 384
xmove# = xmove# + (myX#)
ymove# = ymove# + (myY#)
If ymove# < - 800
ymove# = -800
endif
If ymove# > 800
ymove# = 800
endif
Setcamerarotation(1,ymove# / 16 , xmove# / 16, 0)
setrawmouseposition(512,384)
Print( ScreenFPS() )
Sync()
loop
I try different export options from blender as in the begin it wouldnt even detect the separate objects,No matter wich file format, i made sure each object has an image map assigned in the scene,in this case every single cube, still i dont know why it dosnt work.
In this case i should have 2 cubes with Leaves Texture and One with Bark texture .
SetObjectImage(Map,leaves,0)
SetObjectMeshImage(Map,1,Leaves,0)
SetObjectMeshImage(Map,2,Bark,0)
Any Ideas? I know it work for others, i just cant figure it out.
Animals