To have collisions with 3d objects you need to raycast
Collisions between two objects
//this checks for colliion between an object with any other object and returns its id
width#=(GetObjectSizeMaxX(object)-GetObjectSizeMinX(object))/2
height#=(GetObjectSizeMaxY(object)-GetObjectSizeMinY(object))/2
depth#=(GetObjectSizeMaxZ(object)-GetObjectSizeMinZ(object))/2
x#=getObjectX(object)
y#=GetObjectY(object)
z#=getObjectZ(object)
// calculate the start of the ray cast
start_x# = x#-width#
start_y# = y#+height#
start_z# = z#-depth#
// calculate the end of the ray cast
end_x# = x#+width#
end_y# = y#-height#
end_z# = z#+depth#
// determine which object has been hit
object_hit = ObjectRayCast(0,start_x#,start_y#,start_z#,end_x#,end_y#,end_z#)
Collision between a Sprite and a Mesh Object
Technically raycasting cant be used here so this function checks if the sprites vectors would intercept with the mesh
function checkCollisionObjSpr(obj as integer,index as integer,spr as integer,camID as integer)
local collision as integer
//this checks for collision between a sprite with a 3d mesh and returns 1 if there would be a collision
width=Ceil(GetSpriteWidth(Spr)/2.0)
height=Ceil(GetSpriteHeight(Spr)/2.0) //because the calculations should take place from its centre
check_x = GetSpriteXByOffset(spr)-width
check_y = GetSpriteYByOffset(spr)+height
// get the x, y and z unit vectors based on the sprite position
start_x = Get3DVectorXFromScreen(check_x,check_y)
start_y = Get3DVectorYFromScreen(check_x,check_y)
start_z = Get3DVectorZFromScreen(check_x,check_y)
check_x2 = GetSpriteXByOffset(spr)+width
check_y2 = GetSpriteYByOffset(spr)-height
end_x = Get3DVectorXFromScreen(check_x2,check_y2)
end_y = Get3DVectorYFromScreen(check_x2,check_y2)
end_z = Get3DVectorZFromScreen(check_x2,check_y2)
objStart_x = GetObjectX(obj)+GetObjectMeshSizeMinX(obj,index)
objStart_y = GetObjectY(obj)-GetObjectMeshSizeMinY(obj,index)
objStart_z = GetObjectZ(obj)-GetObjectMeshSizeMinY(obj,index)
objEnd_x = GetObjectX(obj)-GetObjectMeshSizeMaxX(obj,index)
objEnd_y = GetObjectY(obj)+GetObjectMeshSizeMaxY(obj,index)
objEnd_z = GetObjectZ(obj)+GetObjectMeshSizeMaxY(obj,index)
for check=start_x to end_x
if check>objStart_x and check>objEnd_x then coll1=1
next check
for check=start_y to end_y
if check>objStart_y and check>objEnd_y then coll2=1
next check
//if start_z<objStart_z and start_z<objEnd_z then coll3=1
coll3=1
if coll1=1 and coll2=1 and coll3=1
collision=1
else
collision=0
endif
endfunction collision
Object raycast help
https://www.appgamekit.com/documentation/Reference/3D/ObjectRayCast.htmfubar