FANDOM


This command will return the Y offset from the vector stored in previously generated pick data.

Syntax
Return Float=GET PICK VECTOR Y()
Returns

This command will return the Y offset from the vector stored in previously generated pick data

Description

The pick data is generated when the PICK OBJECT and PICK SCREEN commands are used. The vector is relative to the world position of the camera, and so adding the camera position to this vector will result in the 3D world position.

Example Code
sync on : sync rate 60

make object plain 1,300,300

position object 1,0,-50,0

xrotate object 1,270

make object cube 2,100

set shadow shading on 2

set point light 0,-100,500,-100

position camera -200,0,-200

point camera 0,0,0

x#=0:y#=0:z#=0

do

set cursor 0,0

if mouseclick()=0 then pickmode=0

if mouseclick()>0

if pick object(mousex(),mousey(),2,2)>0

if pickmode=0

d#=get pick distance()

x#=get pick vector x():y#=get pick vector y():z#=get pick vector z()

print "object x ",x#," object y ",y#," object z ",z#," distance ",d#

inc pickmode

endif

endif

if pickmode=1

pick screen mousex(),mousey(),d#

dx#=x#-get pick vector x():dy#=y#-get pick vector y():dz#=z#-get pick vector z()

print dx#," ",dy#," ",dz#

endif

position object 2,dx#,dy#,dz#

endif

print x#," ",y#," ",z#

print "CLICK AND HOLD OBJECT TO DRAG"

sync

loop

end
Community content is available under CC-BY-SA unless otherwise noted.