Matheproblem

Previous topic - Next topic

WPShadow

Hi!

Mal wieder hat mich die Mathematik!

Nehmen wir an, ich setze ein Objekt auf Position x, y mit dem Winkel phi!

Nun h?tte ich gerne, da? neben dem Objekt jeweils links und Rechts in der Entfernung 5 davon ein anderes Objekt ist, die aber auch in Richtung phi schauen!

Wie gehe ich das denn am Besten an? Mit Mathe stehe ich leider etwas auf Kriegsfuss...

Gru?

W.
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Schranz0r

Eine L?sung... bin auch net so das mathe Genie :)

Code (glbasic) Select
DRAWRECT 0,0,40,40,RGB(0xff, 0xff, 0xff)
GRABSPRITE 1,0,0,40,40
BLACKSCREEN

DRAWRECT 0,0,20,20,RGB(0xff, 0x00, 0x00)
GRABSPRITE 2,0,0,20,20

LOCAL phi

WHILE TRUE

DEC phi, MOUSEAXIS(0)

ROTOSPRITE 1,320,240, phi
         // * 30 weil sprite 1 -> 40 breit ist und dann durch 2 = 20 + halbes sprite 2
ROTOSPRITE 2,330+COS(-phi)*30,250+SIN(-phi)*30,phi 
ROTOSPRITE 2,330+COS(-phi+180)*30,250+SIN(-phi+180)*30,phi


SHOWSCREEN
WEND
END
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

WPShadow

#2
Habe das Ganze eingebaut!

Funzt jetzt super!

Stelle bald mal einen Screenshot online!
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est