Тема: Камера
Показать сообщение отдельно
Старый 31.08.2006, 17:44   #6
magpro
Разработчик
 
Аватар для magpro
 
Регистрация: 23.08.2006
Сообщений: 586
Написано 6 полезных сообщений
(для 7 пользователей)
Re: Камера

Вот пример как я разобрался

Function sky()
sky=CreateSphere(100)
ScaleEntity sky,800,800,800
FlipMesh sky
EntityFX sky,1
sky_tex=LoadTexture("ter/ne.jpg")
EntityTexture sky,sky_tex
End Function
Function ligh()
For i=1 To 100
Print "Light="+i
li=CreateLight()
PositionEntity li,Rnd(-500,500),15,Rnd(-500,500)
Next
End Function
Function chit()
If KeyDown(86)=1 And ch=0 Then Graphics 1024,768 chit$=Input$("Input you text") ch=1
If KeyDown(86)=1 And ch=1 Then chit$="" ch=0
End Function
Function turbo()
For i=1 To 100
Print "Загруженно "+i+" из 100"
turb=LoadAnimMesh("ter\turbo.x")
Animate turb,2
PositionEntity turb,Rnd(-500,500),0,Rnd(-500,500)
ScaleEntity turb,1,1,1
EntityType turb,tur
Next
End Function
Function el()
For i=1 To 100
Print "Loading object...... "+i+"/500"
elka=LoadMesh("ter\tr.x")
ScaleEntity elka,Rnd(1,3),Rnd(1,5),Rnd(1,3)
PositionEntity elka,Rnd(-500,500),-1,Rnd(-500,500)
EntityType elka,stC
Next
End Function

Function bot()
End Function
Function anim()
ani=LoadAnimMesh("ter\anim.3ds")
Animate ani,1
PositionEntity ani,0,0,20
EntityType ani,avC
End Function

Function TRAP()
For i=1 To 100
Print "trap:"+ i
tr=LoadMesh("ter\tr1.x")
PositionEntity tr,Rnd(-500,500),0,Rnd(-500,500)
EntityType tr,tra
EntityRadius tr,10
Next
End Function

Function graund()
ground=CreatePlane()
EntityColor ground,0,100,0
ground_tex=LoadTexture("ter/gr.jpg")
ScaleTexture ground_tex,10,10
EntityTexture ground,ground_tex
EntityType ground,ter
End Function
Graphics3D 1024,768,32,0
SetBuffer BackBuffer()
Const avC=1,stC=2,tra=3
Const tur=1
Const g#=1
Const ter=3
Global grav,vol#
Global ch=0
Global fntArial
fntArial=LoadFont("Arial Cry",24,False,False,False)
Global windwave#

lit=CreateLight(1)
PositionEntity lit,0,200,0
auto=LoadMesh("ter\av6.3ds")
cam=CreateCamera(auto)
EntityType auto,avC
EntityRadius auto,2
TranslateEntity auto,0,-G#,0
el()
anim()
graund()
ani=LoadAnimMesh("ter\an.x")
Animate ani,1
PositionEntity ani,10,0,50
EntityRadius ani,2
EntityType ani,avC


sky()
Global speed=0
Global t=100
Global s#=0
Global dist#
Global tx#,ty#,tz#,ax#,ay#,az#
Global pl#,sb#
Collisions avC,stC,2,3
Collisions avC,ter,1,3
Collisions avC,avC,2,3
;//**********************************
For i=1 To 100
Print "Загруженно "+i+" из 100"
turb=LoadAnimMesh("ter\turbo.x")
Animate turb,1
PositionEntity turb,Rnd(-500,500),0,Rnd(-500,500)
ScaleEntity turb,0.2,0.2,0.2
EntityType turb,tur
Next
;//***********************************
auto2=LoadMesh("ter\car2.x")
PositionEntity auto2,Rnd(-50,50),0,Rnd(-50,50)
EntityRadius auto2,2
EntityType auto2,avC
EntityPickMode auto2,2
EntityPickMode auto,2

gaz=LoadSound("ter\gaz.wav")
LoopSound gaz
SoundVolume gaz,0.1
PlaySound gaz
PositionEntity auto,1,1,1
zdanie1=LoadMesh("ter\zd1.x")
ScaleEntity zdanie1 ,3,3,3
PositionEntity zdanie1,-50,0,-20
zdanie2=LoadMesh("ter\zd2.x")
ScaleEntity zdanie2 ,3,3,3
PositionEntity zdanie2,20,0,40
EntityType zdanie2,Avc
EntityType zdanie1,Avc

povV=0
povP=0

;------------------------------------------------------------------------
;------------------------------------------------------------------------



Repeat
;If PositionEntity auto,auto+1,auto-0.1,auto Then PositionEntity auto,auto+0.1,auto
;If PositionEntity auto, auto,auto+0.2,auto=1 Then PositionEntity auto,auto-0.2,auto
sb=sb+0.003
PositionEntity cam,0+tx,4+ty,-10+tz
;BOT//////////////***************************
dist# = EntityDistance ( auto2, auto )
If dist > 1
TurnEntity auto2,0,Sgn(DeltaYaw(auto2,auto))*0.9,0
MoveEntity auto2,0,0,sb
EndIf
;PositionEntity auto,xa#,ya#,za#

If EntityCollided (auto2,avC)
TurnEntity auto2,0,5,0
EndIf
;;//////////////////////*****************************




If EntityCollided(auto,ter)=1 Then grav=grav+0.1 PositionEntity auto,0,grav,0

;Управление камеры
If KeyDown(78)=1 Then MoveEntity cam,0,0,.1

If KeyDown(74)=1 MoveEntity cam,0,0,-.1
;------------------------------------------------------------
; Управление Авто
If s>=0 Then
If KeyDown(200)=1 And KeyDown(54)=1 And t>=1 Then s=s+0.005 T=T-1 tz=tz-0.01
If KeyDown(54)=0 And tz<0 Then tz=tz+0.01
If KeyDown (57)=1 And s>0 Then s=s-.02
If KeyDown(200)=1 And speed<220 Then s=s+0.001
If KeyDown(200)=0 And s>0 And s<>0 Then s=s-0.01
End If

If speed>220 Then s=s-0.001
;------------------------------------------------------
If s<=0 Then
If KeyDown (57)=1 And s<0 Then s=s+.02
If KeyDown(208)=1 And speed<60 Then s=s-0.001
If KeyDown(208)=0 And s<0 Then s=s+0.01
End If

;--------------------------------------------------------------
MoveEntity auto,0,0,s
If KeyDown(203)And speed>0 And tx>-1 And pl<0.9Then TurnEntity auto,0,pl=pl+0.01,0 tx=tx-0.03
If KeyDown(203)=0 And tx<0 Then tx=tx+0.02
If KeyDown(203)And speed>0 Then TurnEntity auto,0,1,0
If KeyDown(205)And speed>0 And tx<1 And pl<0.9 Then TurnEntity auto,0,pl=pl-0.01,0 tx=tx+0.03
If KeyDown(203)=0 And tx>0 Then tx=tx-0.02

If KeyDown(205)And speed>0 Then TurnEntity auto,0,-1,0
;----------------------------------------------------------------
If KeyDown(29) And KeyDown(56) And KeyDown(20) Then t =1000

If EntityCollided (auto,stC) s=s-0.01 ay=ay+1

If EntityCollided (auto,ter) ay=ay+1
If EntityCollided (auto,tur) Then t=t+10 PositionEntity turb,0,10,0 s=s-0.01 ay=ay+1


If speed>=0 Then speed=s*50
If speed<=0 Then speed=(s*10)^2

;------------------------------------------------------------------------
;------------------------------------------------------------------------


UpdateWorld
RenderWorld
SetFont fntArial
Text 10,10,"SPEED="+speed+" km/h"
Text 10,30,"TURBO="+t
Flip
Until KeyHit(1)
End




в выделеном участке есть управление камеры с замедлением пользуйся!
(Offline)
 
Ответить с цитированием