Hey Leutz, ich lerne gerade Blitz3D (seit ca. 1ner Woche) und habe ein problem.
Unzwar springt meine Kamera immer und das stört mich extrem.
Hier ist der Code:
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN] Graphics3D 800,600,0,2 SetBuffer FrontBuffer( )
Const TYPE_PLAYER=1,TYPE_TER=2 Global camwegz = 30 Global camwegy = 20 Global oldz Global x1 Global z1 Global cam1
Global player=LoadMesh(\"obj/player.x\") EntityRadius player,5 EntityType player,TYPE_PLAYER MoveEntity player,0,10,0 Global playermo=CreateCube()
Global cam=CreateCamera() CameraRange cam,1,10000
Global light=CreateLight() PositionEntity light,0,40,0
Global map=LoadMesh(\"obj/map.x\") Tex=LoadTexture(\"obj/map.jpg\") EntityTexture map,tex EntityType map,TYPE_TER
Collisions TYPE_PLAYER,TYPE_TER,2,3
While Not KeyDown(1) updatecam() updateplayer()
UpdateWorld RenderWorld Text 10,10,x1 Text 10,25,EntityY(cam) Text 10,40,z1 Text 10,65,cam1 Flip Wend
ClearWorld:End
Function updateplayer() x=(400-MouseX())*-1 z=300-MouseY() PositionEntity playermo,EntityX(player)+x,EntityY(player),EntityZ(player)+z
If MouseDown(1) Then PointEntity player,playermo MoveEntity player,0,0,1 End If
MoveEntity player,0,-1,0 End Function
Function updatecam() If MouseZ() <> oldz Then If MouseZ() > oldz Then camwegz = camwegz-2 If camwegz < 10 camwegz = 10 Else camwegz = camwegz+2 If camwegz > 50 camwegz = 50 EndIf EndIf oldz = MouseZ()
If KeyDown(203) cam1 = cam1-0.5 If KeyDown(205) cam1 = cam1+0.5
x1 = Cos(cam1)*camwegz + EntityX(player) z1 = Sin(cam1)*camwegz + EntityZ(player)
PositionEntity cam,x1,EntityY(player)+camwegy,z1 PointEntity cam,player End Function
Leider kann ich euch die gebrauchten sachen nicht mitliefern (Texturen und Meshs). Den Player Mesh könnt ihr einfach duch einen cube ersetzen. Und die MAP..sorry, kann ich nichts machen..
|