Alright. for this little tidbit I was working on a small app to see scale sizes to help me program. I got confused because I tried to make a bunch of cubes and couldnt seem to use entity pick on the cubes if they were in a Dim. This is ok with me but I also created a plain cube like normal and couldnt pick that until I commented out everything to do with the Dim cubes. I couldnt even pick the plane with those things around. Below is the working code where i can pick the regular cube. you can test the error if you uncomment the blocks where it says to. Thanks.
Graphics3D 800,600,32,2
AppTitle "Scale Test"
SetBuffer BackBuffer()
;Dim cubeg(5) ;uncomment this block
;Global n# = 1
;Global d# = 6
;Global b = 1
;For x=1 To 3
; cubeg(x)=CreateCube()
; ScaleEntity cubeg(x),n#/d#,n#,n#/d#
; EntityColor cubeg(x),255,50,50
; EntityPickMode cubeg(x),2
; n#=n#+1
;Next
;n#=5
;For x=4 To 5
; n#=n#*b
; cubeg(x)=CreateCube()
; ScaleEntity cubeg(x),n#/d#,n#,n#/d#
; EntityColor cubeg(x),255,50,50
; EntityPickMode cubeg(x),2
; b=b+1
;Next
cube=CreateCube()
EntityPickMode cube,2
ScaleEntity cube,1,1,1
EntityColor cube,255,250,50
PositionEntity cube,8,1,-8
Global camera=CreateCamera():EntityRadius camera,5
PositionEntity camera,7,4,-10
CameraViewport camera,0,0,800,600
CameraFogMode camera,1
CameraFogRange camera,8,20
CameraFogColor camera,0,0,0
CameraClsColor camera,0,0,0
;n#=1 ;uncomment this block
;b=1
;For x=1 To 5
; PositionEntity cubeg(x),b,0,0
; b=b+x
;Next
light=CreateLight() ;standard light
RotateEntity light,90,0,0
plane=CreatePlane() ;standard plane
EntityPickMode plane,2
EntityColor plane,50,200,100
;grass_tex=LoadTexture( "media/wcrate.jpg" )
;EntityTexture plane,grass_tex
;Global vv#
While Not KeyDown(1) ;exit on Ecs
If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0 ;controls
If KeyDown( 203 )=True Then TurnEntity camera,0,1,0
If KeyDown( 208 )=True Then MoveEntity camera,0,0,-0.05
If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.05
If KeyDown( 15 )=True Then vv#=vv#+1 ;tab and Q to change a spacific value not used
If KeyDown( 16 )=True Then vv#=vv#-1
If MouseHit(1)=True Then CameraPick(camera,MouseX(),MouseY()) ;pick
RenderWorld
; Text 0,0,"Nearest entity to Cubey: "+EntityPick(cube,vv#)
; Text 0,20,"vv="+vv#
; Text 0,30,"----------"
Text 0,40,"PickedX: "+PickedX#() ;text from some example
Text 0,60,"PickedY: "+PickedY#()
Text 0,80,"PickedZ: "+PickedZ#()
Text 0,100,"PickedNX: "+PickedNX#()
Text 0,120,"PickedNY: "+PickedNY#()
Text 0,140,"PickedNZ: "+PickedNZ#()
Text 0,160,"PickedTime: "+PickedTime#()
Text 0,180,"PickedEntity: "+PickedEntity()
If PickedEntity()=cube Then ;test if it can return a pick
End
EndIf
Flip
Wend
End
|