Its a bug with the way in which AppGameKit creates the cube internally. Only the bottom face has the issue.
It can be fixed with a function:
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "normal_map_bug" )
SetWindowSize( 1024, 768, 0 )
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
// remove global light
SetSunActive(0)
SetAmbientColor( 0, 0, 0 )
// left box with marker
box1 = CreateObjectBox( 5, 5, 5 )
box1 = correctbox(box1)
underside_marker = CreateObjectSphere( 0.5, 10, 10 )
SetObjectPosition( underside_marker, 0, -4, 0 )
SetObjectColorEmissive( underside_marker, 255, 0, 0 )
FixObjectToObject( underside_marker, box1 )
SetObjectPosition( box1, -6, 0, 0 )
SetObjectNormalMap( box1, LoadImage("normal_map_small.png") )
// right box
box2 = CreateObjectBox( 5, 5, 5 )
SetObjectPosition( box2, 6, 0, 0 )
SetObjectNormalMap( box2, LoadImage("normal_map_small.png") )
// light
light_y# = 5
light_z# = -8
light1 as integer = 1
CreatePointLight( light1, 0, light_y#, light_z#, 50, 255, 255, 255 )
SetPointLightMode( light1, 1 )
light_helper = CreateObjectSphere( 0.5, 10, 10 )
SetObjectColorEmissive( light_helper, 255, 255, 255 )
SetObjectPosition( light_helper, 0, light_y#, light_z# )
// camera
SetCameraPosition( 1, 0, 0, -20 )
SetCameraLookAt( 1, 0, 0, 0, 0 )
// action :P
do
Print("Left Box underside (marked red) does not")
Print("interact with the light correctly")
RotateObjectLocalX( box1, 1 )
RotateObjectLocalY( box2, 1 )
Sync()
loop
function correctbox(id)
mblk = CreateMemblockFromObjectMesh(id,1)
deleteobject(id)
//swap x and z
offset = 60+32*4*5
off2c=8
x# = GetMemblockFloat(mblk,offset)
SetMemblockFloat(mblk,offset,-x#)
z# = GetMemblockFloat(mblk,offset+off2c)
SetMemblockFloat(mblk,offset+off2c,-z#)
inc offset,32
x# = GetMemblockFloat(mblk,offset)
SetMemblockFloat(mblk,offset,-x#)
z# = GetMemblockFloat(mblk,offset+off2c)
SetMemblockFloat(mblk,offset+off2c,-z#)
inc offset,32
x# = GetMemblockFloat(mblk,offset)
SetMemblockFloat(mblk,offset,-x#)
z# = GetMemblockFloat(mblk,offset+off2c)
SetMemblockFloat(mblk,offset+off2c,-z#)
inc offset,32
x# = GetMemblockFloat(mblk,offset)
SetMemblockFloat(mblk,offset,-x#)
z# = GetMemblockFloat(mblk,offset+off2c)
SetMemblockFloat(mblk,offset+off2c,-z#)
id = CreateObjectFromMeshMemblock(mblk)
deletememblock(mblk)
endfunction id
it probably wants raising as an issue on github