ok this is where im stuck
camera positions are not on 0,0,0
when you pick a sprite/object you can see clearly that the positions are about as good as it gets but when you release the mouse button it falls (in 3d) somewhere else and i need it to fall exactly where i last picked it, i know its just something im missing here again im not good at math and i should really consider taking a course ...
rem
rem AGK Application
rem
rem Landscape App
SetDisplayAspect(1.0)
type ent
id as integer
width as float
height as float
x as float
y as float
z as float
endtype
type block
e as ent
locked as integer
endtype
global dim sprite[10] as block
global dim object[10] as block
for i = 1 to 10
tempR = random(1,255)
tempG = random(1,255)
tempB = random(1,255)
tempX = random(10,90)
sprite[i].e.id = CreateSprite(0)
SetSpriteSize(sprite[i].e.id,10,10)
SetSpriteColor(sprite[i].e.id,tempR,tempG,tempB,255)
SetSpritePhysicsOn(sprite[i].e.id,2)
SetSpritePosition(sprite[i].e.id,tempX,5)
sprite[i].e.width = 10
sprite[i].e.height = 10
object[i].e.id = CreateObjectBox(10,10,10)
SetObjectColor(object[i].e.id,tempR,tempG,tempB,255)
next i
SetCameraPosition(1,135,75,-90)
rem A Wizard Did It!
global pointX as float
global pointY as float
global pointS as integer
global lastBlock as integer
do
pointX = GetPointerX()
pointY = GetPointerY()
pointS = GetPointerState()
for i = 1 to 10
sprite[i].e.x = GetSpriteXByOffset(sprite[i].e.id)
sprite[i].e.y = GetSpriteYByOffset(sprite[i].e.id)
SetObjectPosition(object[i].e.id,sprite[i].e.x+135,1 - sprite[i].e.y,85+7.5)
SetObjectRotation(object[i].e.id,0,0,GetSpriteAngle(sprite[i].e.id))
next i
if pointS=1
for i = 1 to 10
if pointX >= sprite[i].e.x - sprite[i].e.width/2 and pointX <= sprite[i].e.x + sprite[i].e.width/2
if pointy >= sprite[i].e.y - sprite[i].e.width/2 and pointy <= sprite[i].e.y + sprite[i].e.width/2
sprite[i].locked = 1
lastBlock = i
print(i)
endif
endif
next i
endif
if pointS =1 and sprite[lastBlock].locked = 1
SetObjectPosition(object[lastblock].e.id,Get3DvectorXfromScreen(pointX,pointY)*(90+85+7.5)+135,Get3DvectorYFromScreen(pointX,pointY)*(90+85+7.5)+75,85+7.5)
sprite[lastBlock].e.x = pointX
sprite[lastBlock].e.y = pointY
SetSpritePositionByOffset(sprite[lastBlock].e.id,sprite[lastblock].e.x,sprite[lastblock].e.y)
endif
print(lastBlock)
Sync()
loop