Hey guys!
So, I modified Latches code I found somewhere that makes an object follow the mouse to a GUI Locked on Plains creator.
Run the code, drag the mouse where you want the plain to be, and press enter. The code that makes that plain that is locked on the screen will be copied to the clipboard and you can paste it into your program.
I recommend you to enter a number between 5 and 1000 when asked for the distance.
code:
rem screen GUI position function
rem by TheComet
rem setup screen
input "please enter how far away you want the plain to be from the camera-->",z#
input "please enter object number-->",obj
sync on
sync rate 60
backdrop on
autocam off
rem make 2 objects to define top left and right bottom corner of plain
make object plain 1,0,0
make object plain 2,0,0
rem input
position object 1,0,0,z#
position camera 0,0,0
rotate camera 0,0,0
rem main loop
move#=200-z#
if move#<=0 then move#=1
do
rem object follows mouse
newx#=newxvalue(object position x(1),wrapvalue(camera angle y()+90),(mousemovex())/move#)
newy#=newzvalue(object position y(1),wrapvalue(camera angle y()),(0-mousemovey())/move#)
position object 1,newx#,newy#,z#
position mouse object screen x(1),object screen y(1)
rem position the second object at the first object if mouse is not pressed
if mouseclick()=0 then position object 2,newx#,newy#,z#
rem if mouse is pressed, make a plain out of triangles between the two points
if mouseclick()=1
x1#=object position x(1)
y1#=object position y(1)
x2#=object position x(2)
y2#=object position y(2)
if object exist(3)=1 then delete object 3
if object exist(4)=1 then delete object 4
make object triangle 3,x1#,y1#,z#,x1#,y2#,z#,x2#,y2#,z#
make object triangle 4,x1#,y1#,z#,x2#,y1#,z#,x2#,y2#,z#
else
if object exist(3)=1
delete object 3:if object exist(4)=1 then delete object 4
sx#=abs(x1#-x2#)
sy#=abs(y1#-y2#)
px#=(x1#+x2#)/2
py#=(y1#+y2#)/2
make object plain 3,sx#,sy#
position object 3,px#,py#,z#
lock object on 3
color object 3,rgb(255,0,0)
endif
endif
rem OK
if object exist(3)=1 and object exist(4)=0
center text 320,20,"OK? Press Enter!"
if returnkey()=1
write to clipboard "make object plain "+str$(obj)+","+str$(sx#)+","+str$(sy#)+":position object "+str$(obj)+","+str$(px#)+","+str$(py#)+","+str$(z#)+":lock object on "+str$(obj)
do
center text 320,20,"Data Save to your Clipboard!"
center text 320,40,"Go to your program and use CTRL+V to paste the appropriate code to make your Plain."
center text 320,60,"Press Escape to exit"
sync
loop
endif
endif
rem refresh screen
sync
rem end of main loop
loop
Have fun, hope you find use for it!
TheComet
Peachy, and the Chaos of the Gems
