compass question
Blitz3D Forums/Blitz3D Beginners Area/compass question
| ||
I'm trying to code a compass. Not the round type but the horizontal type that slides left and right. The closest I can get with this task is to use Draw3D2's DrawRect3D command, utilizing UVW (in this case 'U' with the entities Yaw:DrawRect3D(FDrawHandle%,FDrawX#,FDrawY#,FDrawUSet#,FDrawVSet#,FDrawWSet#,FDrawHSet#,FDrawButton%=0,FDrawAngle#=0,FDrawScale#=1) Any ideas? Here's what I've tried. My compassimage is a jpg I created in PS. It's 256px wide, 32px high and contains N | E | S | W |. DrawRect3D(compassimage,0,360,-EntityYaw(cube),0,180,32,0,0) Doesn't work of course since the cube's yaw flips from 180 to -180. Anyone have an idea on this one? |
| ||
flip it based on a variable. |
| ||
Can you adjust the UVs of the texture so that it scrolls left or right? |
| ||
I would offset the uv coordinates too. Check out the PositionTexture function as that sounds like what you need. |
| ||
That did it guys, thanks a bunch! |
| ||
Very crude example of what I ended up with...Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,90,0,0 cube=CreateCube() PositionEntity cube,0,0,5 compass = CreateSprite() ScaleSprite compass,1,.1 PositionEntity compass,0,2,3 tex=CreateTexture(128,18) SetBuffer TextureBuffer(tex) ClsColor 50,50,50 Cls font=LoadFont("verdana",19) SetFont font Color 255,255,255 Text 0,0,"N | E | S | W |" EntityTexture compass,tex SetBuffer BackBuffer() While Not KeyDown(1) compassrot# = EntityYaw(cube) If compassrot# < 0 Then compassrot# = compassrot# + 360 PositionTexture tex,compassrot#/360,0 TurnEntity cube,0,-MouseXSpeed(),0 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 RenderWorld() Flip Wend End |