Newton macht unlogische Dinge

Übersicht BlitzMax, BlitzMax NG Allgemein

Neue Antwort erstellen

Goodjee

Betreff: Newton macht unlogische Dinge

BeitragDo, Mai 21, 2009 14:24
Antworten mit Zitat
Benutzer-Profile anzeigen
Heyho
Zuerst ein Stückchen Code, dass sich ausführen lässt
Code: [AUSKLAPPEN]


'Extern
'Newton Einbinden
'End Extern

Local nWorld:Byte Ptr=NewtonCreate(Null,Null)
Local collision:Byte Ptr= NewtonCreateSphere (nWorld, 2,2,2,Null);

Local ribidBodyBox:Byte Ptr = NewtonCreateBody (nWorld, collision);

NewtonReleaseCollision (nWorld, collision);

Local gravitation:Float[]=[0.0,2.0,0.0]
Local pos:Float[16]
pos[0]=1
pos[5]=1
pos[10]=1
pos[15]=1


Local posi:Byte Ptr=Varptr pos[0]

NewtonBodySetMassMatrix (ribidBodyBox, 1.0, 5.0, 1.0, 5.0);
NewtonBodySetMatrix(ribidBodyBox,Varptr pos[0])
NewtonBodySetOmega (ribidBodyBox, Varptr gravitation[0]);

Local rendertime:Float=1
Repeat
   Local lasttime:Float=MilliSecs()
   NewtonUpdate(nWorld, 5.0);
   Local matrix:Float[4,4]
      NewtonBodyGetMatrix(ribidBodyBox, Varptr matrix[0,0])
   DebugLog matrix[0,0]
   rendertime=MilliSecs()-lasttime
Until KeyHit(KEY_ESCAPE)

NewtonDestroy (nWorld)
End



Das verhält sich aber sehr eigenartig:
1. Wenn ich die völlig unnütze Zeile

Code: [AUSKLAPPEN]
Local posi:Byte Ptr=Varptr pos[0]


rausnehme, tut sich nichts und das programm stürzt ab sobald ich es beenden will

2. Beim setzen der Positionsmattrix muss ich ein eindimensionales Array nehmen damit es läuft, beim auslesen aber ein 2dimensionales

3.

Code: [AUSKLAPPEN]

DebugLog matrix[0,0]+" "+ matrix[1,0] 'geht nicht
DebugLog matrix[0,0] 'geht
DebugLog matrix[1,0] 'geht



Vllt könnt ihr ein bischen Licht ins absolute Dunkel bringen...hoffentlich

Mfg
Goodjee
"Ideen sind keine Coladosen, man kann sie nicht recyclen"-Dr. House
http://deeebian.redio.de/ http://goodjee.redio.de/

Neue Antwort erstellen


Übersicht BlitzMax, BlitzMax NG Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group