Pivot verschieben
Übersicht

![]() |
IguanBetreff: Pivot verschieben |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hallo! Wie kann ich ein Pivot verschieben?
Code: [AUSKLAPPEN] p = createpivot() moveentity p,2,3,5 auch Code: [AUSKLAPPEN] p = createpivot() Translateentity p,2,3,5 geht nicht..., da ein Pivot kein Entity ist... ![]() wie kann ich dennoch einen Pivot verschieben, ohne dass ich ein Parent angeben muss? vielen dank |
||
antome!!! gesperrt !!! |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Wieso sollte es nicht gehen, kommt bei dir eine Fehlermeldung ? | ||
antome |
![]() |
BlitzcoderNewsposter |
![]() Antworten mit Zitat ![]() |
---|---|---|
Natürlich geht das. Aber vielleicht nur, wenn der Pivot wiklich der "vater" eines objekts ist. | ||
P4 3 Ghz@3,55Ghz|GF 6600GT 256MB|Samsung 80GB | 2x Samsung 160GB|2048MB DDR-400 RAM|6 Mbit Flatrate | Logitech G15 | Samsung 225BW-TFT | Ubuntu Gutsy Linux | Windows Vista | Desktop | Blog | CollIDE | Worklog
________________ |°°°°°°°°°°°°°°||'""|""\__,_ |______________ ||__ |__|__ |) |(@) |(@)"""**|(@)(@)****|(@) |
![]() |
Christoph |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] Graphics3D 800,600,32,2
SetBuffer BackBuffer() cam=createcamera() p=createpivot() Repeat If KeyDown(203) Then translateEntity p,-1,0,0 If KeyDown(205) Then translateEntity p,1,0,0 If KeyDown(200) Then translateEntity p,0,0,1 If KeyDown(208) Then translateEntity p,0,0,-1 UpdateWorld RenderWorld Text 0,0,EntityX(p) Text 0,20,EntityY(p) Text 0,40,EntityZ(p) Flip Until KeyDown(1) End Bei mir geht dieser code... |
||
![]() |
Iguan |
![]() Antworten mit Zitat ![]() |
---|---|---|
stimmt, das geht wirklich! Dann liegt es wohl daran, das eines meiner Objekte mehrere Pivots als parent haben.
wieso geht das nicht? Kann man einem objekt nicht mehrere Pivots als parent angeben? |
||
Dreamora |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Doch auch das geht.
Also wenn pivot -> pivot -> pivot ist. Das macht zwar höllisch keinen Sinn, weil ein Pivot, nur ein 3D Punkt ist aber dennoch. Was du auf dem Pivot allerdings nicht machen kannst sind irgendwelche Operationen die Geometrie erfordern (zb die MeshBefehle und so) |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
![]() |
Iguan |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hmm... ich komme dennoch nicht weiter... Ich möchte gerne einen Rubik-Würfel(Zauberwürfel) programmieren, und da möchte ich die einzelnen Ebenen drehen können... nur geht das bei meinem code irgendwie nicht.
vielleicht kann mir jemand bei folgendem code helfen.. Code: [AUSKLAPPEN] Graphics3D 800,600,32,2 Cam=CreateCamera() AmbientLight 255,255,255 MoveEntity Cam,0,2,-10 Dim Wuerfel(27) Dim Piv(9) WuerfelBemalen() i = 0 For Y = 1 To 3 For Z = 1 To 3 For X = 1 To 3 i = i + 1 If X = 1 Then EntityParent Wuerfel(i),Piv(1) If X = 2 Then EntityParent Wuerfel(i),Piv(2) If X = 3 Then EntityParent Wuerfel(i),Piv(3) If Y = 1 Then EntityParent Wuerfel(i),Piv(4) If Y = 2 Then EntityParent Wuerfel(i),Piv(5) If Y = 3 Then EntityParent Wuerfel(i),Piv(6) If Z = 1 Then EntityParent Wuerfel(i),Piv(7) If Z = 2 Then EntityParent Wuerfel(i),Piv(8) If Z = 3 Then EntityParent Wuerfel(i),Piv(9) Next Next Next Repeat If KeyDown(203) TurnEntity Piv(1),0,-1,0 If KeyDown(205) TurnEntity Piv(1),0,1,0 If KeyDown(200) TurnEntity Piv(1),1,0,0 If KeyDown(208) TurnEntity Piv(1),-1,0,0 RenderWorld Flip Until KeyDown(1) End Function WuerfelBemalen() i = 0 For Y = 1 To 3 For Z = 1 To 3 For X = 1 To 3 i = i + 1 Wuerfel(i) = CreateCube() EntityFX Wuerfel(i),2 EntityColor Wuerfel(i),80,80,80 MoveEntity Wuerfel(i),X*2.08,Y*2.08,Z*2.08 If Z = 1 Then FlaecheFaerben(1,i,255,0,0) If X = 3 Then FlaecheFaerben(2,i,255,255,0) If Z = 3 Then FlaecheFaerben(3,i,0,255,0) If X = 1 Then FlaecheFaerben(4,i,0,0,255) If Y = 3 Then FlaecheFaerben(5,i,255,0,255) If Y = 1 Then FlaecheFaerben(6,i,255,255,255) If X = 1 Then FlaecheFaerben(2,i,80,80,80) If X = 2 Then FlaecheFaerben(2,i,80,80,80) If X = 2 Then FlaecheFaerben(4,i,80,80,80) If X = 3 Then FlaecheFaerben(4,i,80,80,80) If Y = 1 Then FlaecheFaerben(5,i,80,80,80) If Y = 2 Then FlaecheFaerben(5,i,80,80,80) If Y = 2 Then FlaecheFaerben(6,i,80,80,80) If Y = 3 Then FlaecheFaerben(6,i,80,80,80) If Z = 1 Then FlaecheFaerben(3,i,80,80,80) If Z = 2 Then FlaecheFaerben(3,i,80,80,80) If Z = 2 Then FlaecheFaerben(1,i,80,80,80) If Z = 3 Then FlaecheFaerben(1,i,80,80,80) If Z = 2 And X = 1 Then Piv(1) = CreatePivot():MoveEntity Piv(1),X*2.08,Y*2.08,Z*2.08 If Z = 2 And X = 2 Then Piv(2) = CreatePivot():MoveEntity Piv(2),X*2.08,Y*2.08,Z*2.08 If Z = 2 And X = 3 Then Piv(3) = CreatePivot():MoveEntity Piv(3),X*2.08,Y*2.08,Z*2.08 If X = 2 And Y = 1 Then Piv(4) = CreatePivot():MoveEntity Piv(4),X*2.08,Y*2.08,Z*2.08 If X = 2 And Y = 2 Then Piv(5) = CreatePivot():MoveEntity Piv(5),X*2.08,Y*2.08,Z*2.08 If X = 2 And Y = 3 Then Piv(6) = CreatePivot():MoveEntity Piv(6),X*2.08,Y*2.08,Z*2.08 If Y = 2 And Z = 1 Then Piv(7) = CreatePivot():MoveEntity Piv(7),X*2.08,Y*2.08,Z*2.08 If Y = 2 And Z = 2 Then Piv(8) = CreatePivot():MoveEntity Piv(8),X*2.08,Y*2.08,Z*2.08 If Y = 2 And Z = 3 Then Piv(9) = CreatePivot():MoveEntity Piv(9),X*2.08,Y*2.08,Z*2.08 Next Next Next End Function Function FlaecheFaerben(Flaeche,i,R,G,B) Surf=GetSurface(Wuerfel(i),1) V = (Flaeche-1) * 4 VertexColor Surf,V,R,G,B VertexColor Surf,V+1,R,G,B VertexColor Surf,V+2,R,G,B VertexColor Surf,V+3,R,G,B End Function |
||
Dreamora |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich bekomme keinen Fehler.
Das es nicht funktioniert, ist klar. Wie sollte es auch ... Du hängst das gesamte zeug an 9 verschiedene Pivots ... Die kein gemeinsames Pivot haben als Parent, welches du eigentlich drehen willst ... |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
![]() |
Iguan |
![]() Antworten mit Zitat ![]() |
---|---|---|
?? kapier ich nicht... wie meinst du das? ein pivot, der ein pivot als parent hat??
ich hab da mal einen beispiel code gemacht... Code: [AUSKLAPPEN] Graphics3D 640,480,0,2 SetBuffer BackBuffer() cam=CreateCamera() PositionEntity cam,0,0,-15 c1 = CreateCube() EntityColor c1,255,0,0 MoveEntity C1,5,2,-5 c2 = CreateCube() EntityColor c2,0,255,0 MoveEntity C2,1,-4,-2 c3 = CreateCube() EntityColor c3,0,0,255 MoveEntity C3,-3,2,2 p1 = CreatePivot() p2 = CreatePivot() MoveEntity P2,-15,0,0 EntityParent C1,P1 EntityParent C2,P1 EntityParent C3,P1 EntityParent C1,P2 EntityParent C2,P2 While Not KeyDown(1) TurnEntity p1,1,2,3 RenderWorld Flip Wend End wieso drehen da nicht alle würfel? wie kann ich machen, dass sich alle würfel drehen, wenn ich P1 drehe, und sich nur 2 Würfel drehen, wenn ich p2 drehe?? vielen dank! |
||
Dreamora |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Erm. Das ist glaub ich offensichtlich, warum sie sich nicht drehen, oder?
Du setzt zwar erst bei allen P1 als parent, ersetzt den parent dann aber wieder durch P2 ... Eine entity kann nur 1 parent haben (da ein objekt nicht durch 2 verschiedene transformationsmatrizen transformiert werden kann). Und was ich oben bei deinem rubik meinte: Du hast Pivot 1 - 9 Im Code drehst du aber nur pivot 1, sprich alles was an 2-9 hängt, bleibt davon total unberührt. Du musst also einen main-pivot erzeugen, welcher parent der pivot 1 - 9 ist und diesen drehen wenn du den ganzen würfel drehen willst. |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
![]() |
Iguan |
![]() Antworten mit Zitat ![]() |
---|---|---|
ach so, danke!
habs jetzt mal so gemacht, dass ich jedesmal allen Würfeln das Parent wegnehme mit Code: [AUSKLAPPEN] Entityparent Wuerfel(i), 0 und anschliessend gruppiere ich die entsprechenden Würfel einer Ebene mit EntityParent Wuerfel(i), Pivot code: Code: [AUSKLAPPEN] Graphics3D 800,600,32,2 Cam=CreateCamera() AmbientLight 255,255,255 MoveEntity Cam,10,8,-10 Global Pivot = CreatePivot() Dim Wuerfel(27) Ebene = 1 WuerfelBemalen() Repeat Winkel = Winkel + 5 If Winkel >= 90 Then Winkel = 0 Ebene = Rnd(1,9) VorZurück = Rnd(-1,1) If VorZurück = 0 Then VorZurück = 1 RotateEntity Pivot,0,0,0 EbeneSetzen(Ebene) End If If Ebene < 4 Then RotateEntity Pivot,Winkel*VorZurück,0,0 If Ebene < 7 And Ebene > 3 Then RotateEntity Pivot,0,Winkel*VorZurück,0 If Ebene > 6 Then RotateEntity Pivot,0,0,Winkel*VorZurück RenderWorld Flip Until KeyDown(1) End Function WuerfelBemalen() i = 0 For Y = 1 To 3 For Z = 1 To 3 For X = 1 To 3 i = i + 1 Wuerfel(i) = CreateCube() EntityFX Wuerfel(i),2 EntityColor Wuerfel(i),80,80,80 MoveEntity Wuerfel(i),X*2.08,Y*2.08,Z*2.08 If Z = 1 Then FlaecheFaerben(1,i,255,0,0) If X = 3 Then FlaecheFaerben(2,i,255,255,0) If Z = 3 Then FlaecheFaerben(3,i,0,255,0) If X = 1 Then FlaecheFaerben(4,i,0,0,255) If Y = 3 Then FlaecheFaerben(5,i,255,0,255) If Y = 1 Then FlaecheFaerben(6,i,255,255,255) If X = 1 Then FlaecheFaerben(2,i,80,80,80) If X = 2 Then FlaecheFaerben(2,i,80,80,80) If X = 2 Then FlaecheFaerben(4,i,80,80,80) If X = 3 Then FlaecheFaerben(4,i,80,80,80) If Y = 1 Then FlaecheFaerben(5,i,80,80,80) If Y = 2 Then FlaecheFaerben(5,i,80,80,80) If Y = 2 Then FlaecheFaerben(6,i,80,80,80) If Y = 3 Then FlaecheFaerben(6,i,80,80,80) If Z = 1 Then FlaecheFaerben(3,i,80,80,80) If Z = 2 Then FlaecheFaerben(3,i,80,80,80) If Z = 2 Then FlaecheFaerben(1,i,80,80,80) If Z = 3 Then FlaecheFaerben(1,i,80,80,80) Next Next Next End Function Function FlaecheFaerben(Flaeche,i,R,G,B) Surf=GetSurface(Wuerfel(i),1) V = (Flaeche-1) * 4 VertexColor Surf,V,R,G,B VertexColor Surf,V+1,R,G,B VertexColor Surf,V+2,R,G,B VertexColor Surf,V+3,R,G,B End Function Function EbeneSetzen(Ebene) For i = 1 To 27 EntityParent Wuerfel(i),0 Next If Ebene = 1 Then PositionEntity Pivot,EntityX(Wuerfel(13)),EntityY(Wuerfel(13)),EntityZ(Wuerfel(13)) EntityParent Wuerfel(1),Pivot, 1 EntityParent Wuerfel(4),Pivot, 1 EntityParent Wuerfel(7),Pivot, 1 EntityParent Wuerfel(10),Pivot, 1 EntityParent Wuerfel(13),Pivot, 1 EntityParent Wuerfel(16),Pivot, 1 EntityParent Wuerfel(19),Pivot, 1 EntityParent Wuerfel(22),Pivot, 1 EntityParent Wuerfel(25),Pivot, 1 EndIf If Ebene = 2 Then PositionEntity Pivot,EntityX(Wuerfel(14)),EntityY(Wuerfel(14)),EntityZ(Wuerfel(14)) EntityParent Wuerfel(2),Pivot, 1 EntityParent Wuerfel(5),Pivot, 1 EntityParent Wuerfel(8),Pivot, 1 EntityParent Wuerfel(11),Pivot, 1 EntityParent Wuerfel(14),Pivot, 1 EntityParent Wuerfel(17),Pivot, 1 EntityParent Wuerfel(20),Pivot, 1 EntityParent Wuerfel(23),Pivot, 1 EntityParent Wuerfel(26),Pivot, 1 EndIf If Ebene = 3 Then PositionEntity Pivot,EntityX(Wuerfel(15)),EntityY(Wuerfel(15)),EntityZ(Wuerfel(15)) EntityParent Wuerfel(3),Pivot, 1 EntityParent Wuerfel(6),Pivot, 1 EntityParent Wuerfel(9),Pivot, 1 EntityParent Wuerfel(12),Pivot, 1 EntityParent Wuerfel(15),Pivot, 1 EntityParent Wuerfel(18),Pivot, 1 EntityParent Wuerfel(21),Pivot, 1 EntityParent Wuerfel(24),Pivot, 1 EntityParent Wuerfel(27),Pivot, 1 EndIf If Ebene = 4 Then PositionEntity Pivot,EntityX(Wuerfel(5)),EntityY(Wuerfel(5)),EntityZ(Wuerfel(5)) For ii = 1 To 9 EntityParent Wuerfel(ii),Pivot, 1 Next EndIf If Ebene = 5 Then PositionEntity Pivot,EntityX(Wuerfel(14)),EntityY(Wuerfel(14)),EntityZ(Wuerfel(14)) For ii = 10 To 18 EntityParent Wuerfel(ii),Pivot, 1 Next EndIf If Ebene = 6 Then PositionEntity Pivot,EntityX(Wuerfel(23)),EntityY(Wuerfel(23)),EntityZ(Wuerfel(23)) For ii = 19 To 27 EntityParent Wuerfel(ii),Pivot, 1 Next EndIf If Ebene = 7 Then PositionEntity Pivot,EntityX(Wuerfel(11)),EntityY(Wuerfel(11)),EntityZ(Wuerfel(11)) EntityParent Wuerfel(1),Pivot, 1 EntityParent Wuerfel(2),Pivot, 1 EntityParent Wuerfel(3),Pivot, 1 EntityParent Wuerfel(10),Pivot, 1 EntityParent Wuerfel(11),Pivot, 1 EntityParent Wuerfel(12),Pivot, 1 EntityParent Wuerfel(19),Pivot, 1 EntityParent Wuerfel(20),Pivot, 1 EntityParent Wuerfel(21),Pivot, 1 EndIf If Ebene = 8 Then PositionEntity Pivot,EntityX(Wuerfel(14)),EntityY(Wuerfel(14)),EntityZ(Wuerfel(14)) EntityParent Wuerfel(4),Pivot, 1 EntityParent Wuerfel(5),Pivot, 1 EntityParent Wuerfel(6),Pivot, 1 EntityParent Wuerfel(13),Pivot, 1 EntityParent Wuerfel(14),Pivot, 1 EntityParent Wuerfel(15),Pivot, 1 EntityParent Wuerfel(22),Pivot, 1 EntityParent Wuerfel(23),Pivot, 1 EntityParent Wuerfel(24),Pivot, 1 EndIf If Ebene = 9 Then PositionEntity Pivot,EntityX(Wuerfel(17)),EntityY(Wuerfel(17)),EntityZ(Wuerfel(17)) EntityParent Wuerfel(7),Pivot, 1 EntityParent Wuerfel(8),Pivot, 1 EntityParent Wuerfel(9),Pivot, 1 EntityParent Wuerfel(16),Pivot, 1 EntityParent Wuerfel(17),Pivot, 1 EntityParent Wuerfel(18),Pivot, 1 EntityParent Wuerfel(25),Pivot, 1 EntityParent Wuerfel(26),Pivot, 1 EntityParent Wuerfel(27),Pivot, 1 EndIf End Function Wie kann ich jetzt machen, das sich der Rubik-Würfel durchmischt? Bei diesem Code wird die Drehung immer rückgängig gemacht ![]() ps: wenn ich Code: [AUSKLAPPEN] RotateEntity Pivot,0,0,0 weglasse, dann fliegt mein würfel auseinander.. |
||
![]() |
Iguan |
![]() Antworten mit Zitat ![]() |
---|---|---|
gibt es eigentlich einen befehl, um einem Objekt, das parent zu löschen, oder muss man
Code: [AUSKLAPPEN] Entityparent Wuerfel(i), 0 machen? |
||
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Use the fu**in' EDIT-Button
bei Doppelposts deinerseits werde ich in Zukunft closen. |
||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group