[B3D] "Tunnel" effekt

Übersicht BlitzBasic Codearchiv

Neue Antwort erstellen

Xaymar

ehemals "Cgamer"

Betreff: [B3D] "Tunnel" effekt

BeitragSo, März 29, 2009 11:52
Antworten mit Zitat
Benutzer-Profile anzeigen
(bzw etwas schiefgegangener code^^)
diesen code kann man auch so anpassen das gelcih ganze endlos tunnel enstehen. leider hab ich noch die smooth rotating movement drin(bzw noch kein plan wieso es nicht geht)
Ich finde es interresant.
Code: [AUSKLAPPEN]
Graphics3D 800,600,0,2
SetBuffer BackBuffer()
SeedRnd MilliSecs()

cam = CreateCamera():CameraRange Cam, 1, 10000

cube=CreateCube(cam)
ScaleEntity cube, -100, -100, -100
EntityFX cube, 9
EntityColor cube,51,51,51

Type waypoints
   Field X#, Y#, Z#, mdl
   Field nextwp
End Type

Global WP.Waypoints
Global DrawWP.Waypoints

;create waypoints
For a = 0 To (360*3)
   NX# = Cos(a/3.0)*100
   NY# = Sin(a)*25
   NZ# = Sin(a/3.0)*100
   
   If WPH <> 0
      WP\NextWP = WPH+1
   EndIf
   
   WP.Waypoints = New Waypoints
   WP\X = NX:WP\Y = NY:WP\Z = NZ
   WP\NextWP = 1
   
   WPH = Handle(WP)
   
   WP\Mdl = CreateCube()
   PositionEntity WP\Mdl, WP\X#, WP\Y#, WP\Z#
   EntityAutoFade WP\Mdl, 45, 50
   EntityAlpha WP\Mdl, .1
   EntityBlend WP\Mdl, 3
   EntityColor WP\Mdl, Rand(255), Rand(255), Rand(255)

   If lmdl <> 0
      PointEntity WP\Mdl, lmdl
      TurnEntity WP\Mdl, 0, 0, a*8+a*8
   EndIf
   lmdl = WP\Mdl
Next

WP.Waypoints = First Waypoints

PositionEntity Cam, WP\X, WP\Y, WP\Z
plrspemax# = .25
plracc# = .05
plrdcc# = .005
plrspe# = 0

While Not KeyHit(1)
   Cls
   TurnEntity cube, 0, 0, 1
   
   MoveEntity Cam, 0, 0, plrspe#
   
   PointEntity Cam, WP\Mdl
   
   If Abs(DeltaPitch(Cam, WP\MDL)) < 45 And Abs(DeltaYaw(Cam, WP\MDL)) < 45
      ttimer = ttimer + 1
      If ttimer > 10
         plrspe# = plrspe# + plracc#
         If plrspe# > plrspemax# plrspe# = plrspemax#
         ttimer = 0
      EndIf
   Else
      ttimer = ttimer + 1
      If ttimer > 10
         plrspe# = plrspe# - plrdcc#
         If plrspe# < 0 plrspe# = 0
         ttimer = 0
      EndIf
   EndIf
   
   If Abs(EntityDistance(Cam, WP\Mdl)) < 2
      WPN.Waypoints = Object.Waypoints(WP\NextWP)
      WP.Waypoints = WPN.Waypoints
      DebugLog Handle(WPN) + " " + Handle(WP) + " " + WP\NextWP
   EndIf
   
   RenderWorld
   
   ;Debugging
   Text 0,  0, "X: "+EntityX(Cam) + " " + EntityPitch(Cam)
   Text 0, 15, "Y: "+EntityY(Cam) + " " + EntityYaw(Cam)
   Text 0, 30, "Z: "+EntityZ(Cam)
   Text 0, 45, "DP: "+DeltaPitch(Cam, WP\Mdl)
   Text 0, 60, "DY: "+DeltaYaw(Cam, WP\Mdl)
   Text 0,100, "DE: "+EntityDistance(Cam, WP\Mdl)
   Text 0,115, "PS: "+plrspe#
   Text 0,130, "WP: "+Handle(WP)
   
   Flip
Wend

End


Beschreibung:
mit jedem Waypoint kannst du dir ein mdl/bbobjekt hinstellen an X/Y/Z. Die kamera steuert diesen dann an sofern ein waypoint den NextWP auf diesen gesetzt hat
Warbseite

Neue Antwort erstellen


Übersicht BlitzBasic Codearchiv

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group