hay all, I know this is gona be something really really daft, but its buggin me so i thought id ask.
If you need the media I will provide it as well just let me know.
ok, What im trying to do is have this target moved by the mouse, the ship will face the target at all times, I'm using the Delta Yaw method to do this(found on a forum search) ..
The Problem is that as I move the target from left to right, as I pass over the ship and go into its right hand side the ship flips over.
Any Ideas ?
If you need the media I will provide it as well just let me know.
ok, What im trying to do is have this target moved by the mouse, the ship will face the target at all times, I'm using the Delta Yaw method to do this(found on a forum search) ..
The Problem is that as I move the target from left to right, as I pass over the ship and go into its right hand side the ship flips over.
Any Ideas ?
; ; ; Asteroids Remake. ; ; This mini project has been started as a test bed for some of the things ; I plan to implement into the SolarShatter code base. ; ; Graphics3D 800,600,32,2 SetBuffer BackBuffer() Cls HidePointer() Global cam=CreateCamera() PositionEntity cam,0,0,-20 Global light=CreateLight() Global background=CreatePlane() Global texture_background=LoadTexture("img/bg1.jpg") RotateEntity background,-90,0,0 ScaleTexture texture_background,40,30 PositionTexture texture_background,.50,.50 EntityTexture background,texture_background Global line_vert=LoadImage("img/vert.jpg") Global line_hor=LoadImage("img/hor.jpg") Global Target=LoadImage("img/target.bmp"):MidHandle target:MaskImage target,255,0,255 Global mouse_pivot=CreateSphere(3) Global PLayer_Ship=LoadMesh("models/ship.3ds") ScaleEntity player_ship,.02,.02,.02 HideEntity PLayer_Ship Type player Field x# Field y# Field z# Field turn_rate# Field turn_amount# Field sight_pivot Field model End Type Global player.player = New player player\x=0 player\y=0 player\turn_rate=1.5 player\model=CopyEntity(player_ship) PositionEntity player\model,0,0,-2 HideEntity background t=CreateSphere(3) PositionEntity t,0,20,-2 player\sight_pivot=CreatePivot() PositionEntity player\sight_pivot,0,0,-2 EntityParent player\model,player\sight_pivot RotateEntity player\model,0,0,90 ;Play out the game intro Intro() Function Intro() GUI() End Function End Function GUI() Local ENDGUI=False Repeat Cls GUI_Update() GUI_Render() UpdateWorld() RenderWorld() GUI_Render_2D() If KeyHit(57)=1 Then Game() Flip False Until KeyHit(1) Or ENDGUI=True End Function Function GUI_Update() End Function Function GUI_Render() End Function Function GUI_render_2D() End Function Function GAME() Local ENDGAME=False Repeat Cls GAME_Update() GAME_Render() UpdateWorld() RenderWorld() GAME_render_2d() Flip Until KeyHit(1) Or ENDGAME=True End Function Function GAME_update() PositionEntity mouse_pivot,-19.1+(MouseX()/20.99),-(-14.2+(MouseY()/20.99)),-2 PointEntity player\sight_pivot,mouse_pivot game_align(player\model,mouse_pivot,1) End Function Global switch=False Function game_align( Entity, Target, Smooth# ) dp# = GAME_LIMIT ( DeltaPitch( Entity , Target ) , -Smooth , Smooth ) dy# = GAME_LIMIT ( DeltaYaw( Entity , Target ), -Smooth , Smooth ) TurnEntity Entity, 0 , dy , 0 End Function Function GAME_LIMIT#( q# , low# , hi# ) If q < low q = low If q > hi q = hi Return q End Function Function GAME_render() PositionEntity player\model,player\x,player\y,-2,1 End Function Function GAME_render_2D() DrawImage line_hor,0,MouseY(),0 DrawImage line_vert,MouseX(),0,0 DrawImage target,MouseX(),1+MouseY(),0 Text 1,1,"Yaw :"+EntityYaw(player\model,1) Text 1,20,"pit :"+EntityPitch(player\model,1) Text 1,30,"rol :"+EntityRoll(player\model,1) End Function