collisions
Übersicht

Om3nBetreff: collisions |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
hallo,
ich bekomme einfach keine kollision zustande! warum bitte nicht? Code: [AUSKLAPPEN] planet=CreateSphere(100)
EntityType planet,plancol PositionEntity planet,0,250,700 ScaleEntity planet,10,10,10 ;WireFrame 1 RotateEntity tmesh,0,180,0 EntityType tmesh,spaceship EntityRadius tmesh,50 PositionEntity tmesh,0,230,100 PositionEntity cam,0,250,0 EntityParent tmesh,cam ShowEntity tmesh ;PositionEntity tmesh,0,250,0 MoveMouse 400,300 Collisions spaceship,plancol,2,1 ;main loop While Not KeyHit(1) Cls mx=mx+MouseXSpeed() my=my+MouseYSpeed() If MouseX()>405 Or MouseX()<395 Then MoveMouse 400,300 EndIf If MouseY()>305 Or MouseY()<295 Then MoveMouse 400,300 EndIf If KeyDown(17) Then MoveEntity cam,0,0,+0.5 EndIf RotateEntity cam,my,-mx,0 RenderWorld UpdateWorld Flip Wend vielen dank für hilfe! |
||
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Du hast hier zwei Variablen als Kollisionstypen verwendet "spaceship" und "plancol", um zwei Entitys kollidieren zu lassen. Da beide Variablen nicht definiert wurden und daher null sind, funktioniert das ganze nicht.
Beiden Variablen müsstest du vor ihrer Verwendung irgendwelche Werte zuweisen: Code: [AUSKLAPPEN] spaceship = 1 plancol = 2 [... dein code] |
||
Om3n |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
hallo,
@coldie: danke für den hinweis, brachte aber rein gar nichts. woran könnte es noch liegen, bin am verzweifeln! |
||
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich hab es doch probiert und es funktioniert!
Allerdings hab ich zusätzlich noch dem "Planet" einen Kollisionsradius zugewiesen und ihn auf gleicher Höhe mit dem spaceship positioniert. Code: [AUSKLAPPEN] PositionEntity planet,0,250,100 |
||
Om3n |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
also dem planeten auch ein entityradius geben? weil davon gar nichts in der hilfe stand...
edit: so, ich hab jetzt alles ausprobiert, es will einfach gar nicht... überhaupt nicht... evtl. sind bei mir die collision befehle kaputt... ka ... spaß vorbei! |
||
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ne hast recht, du hast Kollisionsmethode 2 gewählt, deshalb brauchst du für planet keinen Radius anzugeben. Ich würde dir aber raten Kollisionsmethode 1 zu nehmen, weil das viel schneller ist.
hier der code, funktioniert bei mir einwandfrei (hab den Kollisionsradius von tmesh runtergesetzt, so dass er mit der Grafik übereinstimmt und planet verkleinert, weil man ihn sonst nicht sieht) Code: [AUSKLAPPEN] Graphics3D 640,480 SetBuffer BackBuffer() cam=CreateCamera() plancol = 1 spaceship = 2 planet=CreateSphere(100) EntityType planet,plancol PositionEntity planet,0,250,100 ScaleEntity planet,10,10,10 ;WireFrame 1 tmesh=CreateSphere() RotateEntity tmesh,0,180,0 EntityType tmesh,spaceship EntityRadius tmesh,1 PositionEntity tmesh,0,230,100 PositionEntity cam,0,250,0 EntityParent tmesh,cam ShowEntity tmesh ;PositionEntity tmesh,0,250,0 MoveMouse 400,300 Collisions spaceship,plancol,2,1 ;main loop While Not KeyHit(1) Cls mx=mx+MouseXSpeed() my=my+MouseYSpeed() If MouseX()>405 Or MouseX()<395 Then MoveMouse 400,300 EndIf If MouseY()>305 Or MouseY()<295 Then MoveMouse 400,300 EndIf If KeyDown(17) Then MoveEntity cam,0,0,+0.5 EndIf RotateEntity cam,my,-mx,0 RenderWorld UpdateWorld Flip Wend |
||
Om3n |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
ok, danke, hat funktioniert. hab noch einen fehler gefunden gehabt! | ||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group