Problem mit Pivot
Übersicht

smeagle24Betreff: Problem mit Pivot |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hallo,
hab folgendes Problem. Ich habe einen pivot und eine Kamera erstellt. Beides wird an der selben Position positioniert und soll sich synchrone miteinander bewegen. Nur wenn ich die Kamaera bewege, bewegt sich der Pivot nur auf der Y- und Z-Achse mit der Kamera mit und auf der X-Achse bewegt der sich komplett anders. Kann mir vielleicht jemand sagen wo ich hier was falsch gemacht habe? Code: [AUSKLAPPEN] Type schuss
Field x,y,z Field timer Field mesh End Type Graphics3D 800,600,16,1 SetBuffer BackBuffer() AmbientLight 200,200,200 Global Timer=CreateTimer(60) Global light=CreateLight() RotateEntity light,90,0,0 Global Camera=CreateCamera() PositionEntity Camera,30,10,3 RotateEntity Camera,0,90,0 Global cam_pivot=CreatePivot() PositionEntity cam_pivot,30,5,3 RotateEntity cam_pivot,0,90,0 EntityType cam_pivot,1 EntityRadius cam_pivot,1 While Not KeyHit(1) Cls Game() Flip Wend End Function Game() level1=LoadMesh("includes\level1.b3d") PositionEntity level1,0,.1,0 level1_tex=LoadTexture("includes\rough.jpg") EntityTexture level1,level1_tex,1 ScaleEntity level1,2,1.5,2 EntityType level1,2 While Not KeyHit(1) MoveMouse 400,250 Cls ;FPS counter=counter+1 If time=0 Then time=MilliSecs() If time + 1001< MilliSecs() Then framerate=counter counter=0 time=MilliSecs() EndIf Steuerung() Schiessen() Bullet_Bewegen() Collisions 1,2,2,3 UpdateWorld() RenderWorld() Text 50,50,EntityX(Camera) Text 50,70,EntityY(Camera) Text 50,90,EntityZ(Camera) Text 50,110,"FPS: " +framerate Text 50,130,EntityZ(cam_pivot) Text 50,150,EntityY(cam_pivot) Text 50,170,EntityZ(cam_pivot) fadenkreuz=LoadImage("includes\fadenkreuz.bmp") MaskImage fadenkreuz,255,255,255 DrawImage fadenkreuz,MouseX()-50,MouseY() WaitTimer(Timer) Flip Wend End End Function Function Steuerung() TurnEntity cam_pivot,0,0 -MouseXSpeed(),0 TurnEntity Camera, MouseYSpeed(),0,0 RotateEntity cam_pivot, EntityPitch#(cam_pivot), EntityYaw#(cam_pivot),0 RotateEntity Camera, EntityPitch#(Camera), EntityYaw#(cam_pivot),0 If KeyDown(31) Then MoveEntity cam_pivot, 0, 0,-.8 If KeyDown(17) Then MoveEntity cam_pivot, 0, 0,.8 If KeyDown(32) Then MoveEntity cam_pivot, .8, 0, 0 If KeyDown(30) Then MoveEntity cam_pivot, -.8,0, 0 PositionEntity Camera, EntityX#(cam_pivot), EntityY#(cam_pivot), EntityZ#(cam_pivot) PositionEntity cam_pivot, EntityX#(Camera), EntityY#(Camera), EntityZ#(Camera) End Function Function Bullet_Erstellen() a.schuss = New schuss a\mesh = CreateSphere(8) ScaleEntity a\mesh,1,1,1 ;ScaleEntity a\mesh,.1,.1,.1 a\x=EntityX(cam_pivot) a\y=EntityY(cam_pivot) a\z=EntityZ(cam_pivot) EntityType a\mesh,1 EntityRadius a\mesh,1 PositionEntity a\mesh,a\x,a\y,a\z RotateEntity a\mesh ,EntityPitch(Camera),EntityYaw(cam_pivot),EntityRoll(Camera) End Function Function Bullet_Bewegen() For a.schuss = Each schuss MoveEntity a\mesh,0,0,.5 ;If EntityCollided(a\mesh,2) Then ; FreeEntity a\mesh : PlaySound(sound) ; Delete a ;EndIf Next End Function Function Schiessen() If MouseHit(1) Bullet_Erstellen() End If End Function |
||
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich würde vorschlagen:
EntityParent ![]() Edit: Du Lädst in Game() Daten in der Hauptschleife - das hält kein Computer lange aus ![]() Du verwendest weiterhin mehr als ein Flip: Das macht keinen Sinn. |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
smeagle24 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Das mit dem mehrmals Flip() hab ich korrigiert.
Wenn ich EntityParent cam_pivot,camera einfüge, dann rotiert bei jeder Mausbewegung die Kamera weitläufig um den Pivot. |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group