Hilfe

EntityBox

B3D

Aufruf

EntityBox entity%, x#, y#, z#, breite#, hoehe#, tiefe#

Parameter

entity% Identität eines Objekts (entity)
x# X-Koordinate der Kollisionbox
y# Y-Koordinate der Kollisionbox
z# Z-Koordinate der Kollisionbox
breite# Breite der Kollisionbox
hoehe# Höhe der Kollisionbox
tiefe# Tiefe der Kollisionbox


Rückgabewert

-


Beschreibung

Die Anweisung EntityBox definiert eine quaderförmige Kollisionsfläche für ein Objekt.

In BlitzBasic gibt es zwei definierbare Kollisionsflächen: Quader (EntityBox) und Kugel (EntityRadius). Hat man die Kollisionsfläche gewählt, dann kann man noch zusätzlich mit dem Befehl EntityType den Kollisionstyp einstellen. Mit dem Befehl Collisions wird die Kollisionsprüfung aktiviert.


Beispiel

Standardbeispiel:

Graphics3D 640, 480
SetBuffer BackBuffer()
camera = CreateCamera()
RotateEntity camera, 45, 0, 0
PositionEntity camera, 0, 15, - 10
light = CreateLight()
RotateEntity light, 45, 0, 0

sphere = CreateSphere(32)
EntityType sphere, 1
EntityRadius sphere, 1
PositionEntity sphere, 0, 15, 0

cube = CreateCube()
EntityBox cube, - 10, - 10, - 10, 20, 20, 20
EntityType cube, 2
EntityColor cube, 0, 100, 0
PositionEntity cube, 0, - 5, 0
ScaleEntity cube, 10, 10, 10

box = CreateCube()
EntityBox box, - 3, - 3, - 3, 6, 6, 6
EntityType box, 2
EntityColor box, 255, 0, 0
PositionEntity box, 0, 7, 0
ScaleEntity box, 2, 2, 2

Collisions 1, 2, 3, 2

While Not KeyDown(1)
   x# = 0
   y# = 0
   z# = 0
   If KeyDown(203) = 1 Then x# = - 0.1
   If KeyDown(205) = 1 Then x# = 0.1
   If KeyDown(208) = 1 Then z# = - 0.1
   If KeyDown(200) = 1 Then z# = 0.1
   MoveEntity sphere, x#, - 0.1, z#
   UpdateWorld
   RenderWorld
   Flip
Wend
End


Siehe auch

Collisions, EntityPickMode, EntityRadius, EntityType

Übersicht 3D Grafik Kollision