Hilfe
Parameter
entity% | Identität eines Objekts (entity) |
Rückgabewert
Kollisionstyp des Objekts
Beschreibung
Die Funktion GetEntityType liefert den Kollisionstyp eines Objekts. Dieser Kollisionstyp kann mit dem Befehl EntityType eingestellt werden.
Damit nicht erst alle Objekte auf Kollision überprüft werden müssen (was einen enorm großen Rechenaufwand darstellt), können nur bestimmte Kollisionsgruppen ausgewählt werden. Die Gruppe wird mit dieser Funktion abgefragt.
Beispiel
Standardbeispiel:
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, 11, 0
cube = CreateCube()
EntityType cube, 2
EntityColor cube, 0, 100, 0
PositionEntity cube, 0, - 5, 0
ScaleEntity cube, 10, 10, 10
cylinder = CreateCylinder(32)
EntityType cylinder, 2
EntityColor cylinder, 255, 0, 0
PositionEntity cylinder, 0, 7, 0
ScaleEntity cylinder, 2, 2, 2
Collisions 1, 2, 2, 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
Text 0, 0, "Kollisionstyp der Kugel:" + GetEntityType(sphere)
Text 0, 20, "Kollisionstyp des Zylinders:" + GetEntityType(cylinder)
Text 0, 40, "Kollisionstyp des Bodens:" + GetEntityType(cube)
Flip
Wend
End
Siehe auch

