GLBasic forum

Other languages => GLBasic - de => Topic started by: Tenorm on 2009-Apr-03

Title: Types + Newton
Post by: Tenorm on 2009-Apr-03
Hi,

einfach mal kleines BSP:

Code (glbasic) Select

TYPE thing
     id
     x
     y
     z
ENDTYPE
GLOBAL new_thing AS thing
GLOBAL things[] AS thing

FUNCTION make_thing: id, x, y, z
     new_thing.id=id
     new_thing.x=x
     new_thing.y=z
     new_thing.z=z
     newton....
     DIMPUSH things[], new_thing
ENDFUNCTION

FOREACH new_thing IN things[]
     newton...
     newtonbodygetmatrix(new_thing.id,M[])
     ...
NEXT


So, wenn ich z.B. die Matrix des Objektes auslesen will, um z.B. ein Modell daran auszurichten, bringt mir newton immer nur die matrix des ersten Mitgliedes von things[], was wahrscheinlich daran liegt, dass newton nicht den wert von new_thing.id verwendet, sondern new_thing.id als String oder so einliest...

Jemand ne Ahnung was man da machen kann? (id$ statt id hab ich schon probiert...)

Danke Tenorm
Title: Re: Types + Newton
Post by: amarliani on 2009-Apr-03
Schon mal versucht, den Inhalt von new_thing.id einfach in ne Zwischenvariable zu schreiben und die an Newton zu ?bergeben? Nicht elegant, aber wenns geht...

Ich mein das so:

Code (glbasic) Select

...
FOREACH new_thing IN things[]
     newton...
     id=new_thing.id
     newtonbodygetmatrix(id,M[])
     ...
NEXT
...
Title: Re: Types + Newton
Post by: Schranz0r on 2009-Apr-03
liegt bestimmt nich daran.
Title: Re: Types + Newton
Post by: Tenorm on 2009-Apr-04
ja, liegt nicht daran...

Gernot, wie lautet die Diagnose?
Title: Re: Types + Newton
Post by: Schranz0r on 2009-Apr-04
kann auch nicht daran liegen da ich das so auch schonmal gemacht hatte...
Gib mal einen fetzen Code, der das Problem zeigt.
Title: Re: Types + Newton
Post by: Tenorm on 2009-Apr-05
Ich seh grad, dass gernot sowas ?hnliches im Pingloo gemacht hat, aber eben nicht mit Types sondern mit einem Variablenfeld...
Title: Re: Types + Newton
Post by: Kitty Hello on 2009-Apr-06
Du ?berschreibst "M[]" ja in der Schleife dauernd!?
Title: Re: Types + Newton
Post by: Tenorm on 2009-Apr-06
muss ich doch?!

Das Ding bewegt sich ja auch und deshalb muss die Model-Position ja angeglichen werden.
Title: Re: Types + Newton
Post by: Kitty Hello on 2009-Apr-06
FOREACH new_thing IN things[]
     newton...
     newtonbodygetmatrix(new_thing.id,M[])
     ...
NEXT

warum nicht

     newtonbodygetmatrix(new_thing.id,  new_thing . M[])
Title: Re: Types + Newton
Post by: Tenorm on 2009-Apr-06
hey  :good:
funktioniert mal wieder 1A, danke!

obwohl ich jez nicht richtig kappiert habe warum das Feld nicht f?r alle verwendet und ?berschrieben werden darf...