Entity cursor following

Blitz3D Forums/Blitz3D Programming/Entity cursor following

Try this PaulJG

u will need a bitmap for the ground

Graphics3D 800,600,16,1
SetBuffer BackBuffer()

light=CreateLight()

Collisions 3,2,2,2

Global pointer = CreateSphere()
ScaleEntity pointer,.5,.5,.5
EntityColor pointer,0,256,0
EntityType pointer,2

Global cube=CreateCube()
EntityRadius cube,2,2
EntityType cube,3

Global cam=CreateCamera(pointer)
CameraRange cam,.1,1000
TurnEntity cam,0,0,0
RotateEntity cam,45,0,0
EntityType cam,2
PositionEntity cam,0,80,-80

pl=CreatePlane()
tex=LoadTexture("grass3.bmp")
ScaleTexture tex,64,64
EntityTexture pl,tex
EntityOrder pl,1
EntityFX pl,1
EntityType pl,1
EntityPickMode pl,2
ScaleEntity pl,1,1,1

While Not KeyDown(1)



If MouseDown(1)=True

picked=CameraPick(cam,MouseX(),MouseY())

PositionEntity pointer,PickedX(),0,PickedZ()

MoveEntity cube,0,0,pz+1


EndIf

movebloke()

UpdateWorld
RenderWorld


Flip

Wend

End

Function movebloke()

mx#=MouseXSpeed()*0.2
my#=-MouseYSpeed()*0.2

MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
MoveEntity pointer,mx,0,my

PointEntity cube,pointer

End Function


Thanks

GIMPY ;)