Autor Beitrag
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Do 03.07.03 19:58 
Hallo,
wie funktioniert der CollisionManager von GLScene ?
kann mir das jemmand sagen?
irgenwie geht das nicht. wollte ein brekout schreiben und habe deshalb die CollisionManager komponenten genommen, aber es wird keine colisions ausgelöst.

_________________
MFG
Michael Springwald, "kann kein englisch...."


Zuletzt bearbeitet von mimi am Do 10.07.03 21:27, insgesamt 1-mal bearbeitet
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Fr 04.07.03 17:00 
hier der code den ich dazu verwndet habe:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
var
  newBallPos : TVector;
  i:Byte;
begin


  if (not gameOver) and (deltaTime>0then begin // Die ränder
    newBallPos:=VectorCombine(Ball.Position.AsVector, ballVector, 1, deltaTime);
    if newBallPos[0]<-7.05 then
      ballVector[0]:=-ballVector[0]
    else
      if newBallPos[0]>7.05 then
        ballVector[0]:=-ballVector[0]
  else
      if newBallPos[1]>4.55 then
        ballVector[1]:=-ballVector[1];

  end;

  if newBallPos[1]<-4 then begin // Prüfen ob es eine colisions mit dem pad gebgen hat.
    for i:=1 to 3 do begin
      with TGLCube(FindComponent('Stein' + IntToStr(i))) do begin
        if (newBallPos[0]>Position.X) and (newBallPos[0]<Position.X) then begin
          ballVector[1]:=-ballVector[1];
          ballVector[0]:=ballVector[0]+(Random(100)-50)/50;
          ballVector[1]:=ballVector[1]+0.1;
          ShowMessage('TEST');
          gameOver:=True;
        end;
      end;
    end;

    if (newBallPos[0]>Pad.Position.X-1.25and (newBallPos[0]<Pad.Position.X+1.25then begin
      ballVector[1]:=-ballVector[1];
      ballVector[0]:=ballVector[0]+(Random(100)-50)/50;
      ballVector[1]:=ballVector[1]+0.1;
      Inc(score);
      SpaceText1.Text:=Format('%.3d', [score]);
    end
    else begin
      gameOver:=True;
      ResetGame;
    end
  end;

  CollisionManager1.CheckCollisions;
   with Ball.Position do
     AsVector:=VectorCombine(AsVector, ballVector, 1, deltaTime);

habe das beispiel pong genommen und will draus jetzt ein breakOut clone bauen.
und im onColisiosn ereignis habe ich einfach nur stehen
ShowMessage('TEST');

_________________
MFG
Michael Springwald, "kann kein englisch...."
Nightmare_82
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 260



BeitragVerfasst: Fr 04.07.03 18:28 
Also die procedure CheckCollisions funktioniert mit Siherheit. Ich tippe mal, daß es aussieht als gäbe es eine Kollision, aber die Objekte stehen in Wirklichkeit hintereinander ohne sich zu berühren.
Stell mal zum Test 2 Objekte auf dieselbe Position. Wenn dann die Message kommt liegts wohl an den Koordinaten.
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Fr 04.07.03 19:04 
soll ich dir mal das ganze projekt senden ?
vileicht findes du den fehler.

_________________
MFG
Michael Springwald, "kann kein englisch...."
Nightmare_82
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 260



BeitragVerfasst: Sa 05.07.03 01:28 
ok, kannste machen.
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Sa 05.07.03 12:20 
kannst mir eine pm senden mit deiner mail ?

_________________
MFG
Michael Springwald, "kann kein englisch...."
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Sa 05.07.03 16:13 
problem gelöst....

_________________
MFG
Michael Springwald, "kann kein englisch...."