Bat i still dont see how that helps me
can you please take a look at the following code and maybe help out ?
SetWindowTitle( "3dimagetest" )
SetWindowSize( 1024, 768, 0 )
SetVirtualResolution( 1024, 768 )
rImg = CreateRenderImage(1024,1024,0,0)
rOBj = CreateObjectPlane(100,100)
dSpr = CreateSprite(0)
bSpr = CreateSprite(0)
SetSpriteSize(dSpr,15,15)
SetSpriteSize(bSpr,1024,768)
SetspriteColor(bSpr,0,255,0,255)
SetSpriteDepth(bSpr,9999)
MoveCameraLocalZ(1,-150)
SetObjectLookAt(rObj,GetCameraX(1),GetCameraY(1),GetCameraZ(1),0)
global hit3d as integer
do
px# = GetPointerX()
py# = GetPointerY()
ps = GetPointerState()
SetSpritePositionByOffset(dspr,px#,py#)
hit3d = 1
/*
x1# = 100*Get3DVectorXFromScreen(px#,py#)+GetCameraX(1)
y1# = 100*Get3DVectorYFromScreen(px#,py#)+GetCameraY(1)
z1# = 100*Get3DVectorZFromScreen(px#,py#)+GetcameraZ(1)
ObjectRayCast(0,GetCameraX(1),GetcameraY(1),GetCameraZ(1),x1#,y1#,z1#)
hit3d = GetObjectRayCastHitID(0)
*/
SetSpriteVisible(dspr,0)
SetOBjectVisible(rObj,0)
SetSpriteVisible(bSpr,1)
SetRenderToImage(rImg,0)
ClearScreen()
if ps= 1
if hit3d > 0
SetSpriteColor(dspr,255,0,0,255)
SetSpriteVisible(dspr,1)
DrawSprite(dSpr)
/*
newx# = GetObjectRayCastX(0)
newY# = GetObjectRayCasty(0)
newZ# = GETObjectRayCastZ(0)
*/
//a = CreateObjectBox(10,10,10)
//SetOBjectPosition(a,newX#,newY#,newZ#-1)
//SetObjectColor(a,random(1,255),random(1,255),random(1,255),0)
endif
//SetSpriteVisible(dspr,0)
endif
render()
SetRenderToScreen()
SetSpriteVisible(bSpr,0)
SetOBjectImage(rObj,rImg,0)
SetSpriteVisible(dspr,1)
SetSpriteColor(dspr,0,0,255,255)
drawSprite(dspr)
SetOBjectVisible(rObj,1)
render()
swap()
loop
the idea as the same like here but only that the correct positions should be transformed into 3D then back into 2D screen coords
it should only paint when the mouse cursor is on the 3d plane and in the exact position as the 3d raycast x,y,z that hits the 3d plane.
im trying to work it out but without succes so far..
if you can share any thoughts please do.
haliop.
p.s maybe TGC should consider adding extra features to RenderToImage such as FixXYtoRenderToImage before the drawSprite calls or something i dont know... just so it would work automatic without the use of extra code which will make users lose more battery then needed....
i think TGC should consider making RenderToImage ever simplier to handle since RenderToImage is the feature that will make AppGameKit be able to Get as far to AAA games and apps cause honestly you cant do whatever you want on mobiles since of limitations however using Sprites/Planes with a decent rendered image will make our games look much much better.