Please take a look to the following piece of code
I want to have my entities to move in terms of velocities. The question is:
What is the velocity of Y-Axis, velyaw, in order to get the Cube rotated exactly 180 degrees within 1 second?
If you run the program you will see that I don't get the desired result setting the velyaw to 180 degrees/sec. OK I know that I am wrong but I don't know where!
Thanks
Const FPS = 60 Global FramePeriod% ; main game loop timing Global FrameTime% Global FrameElapsed% Global FrameTicks% Global FrameTween# Global ProgramEnd% = False Graphics3D 640, 480, 16, 0 SetBuffer BackBuffer() camera = CreateCamera() : MoveEntity camera, 0, 0, -10 light = CreateLight() cube = CreateCube() Frame_Init() Global dpitch# Global dyaw# Global droll# Global velpitch# = 0 Global velyaw# = 180 Global velroll# = 0 start_time% = -1 While Not ProgramEnd If KeyHit(1) Then ProgramEnd = True Frame_Capture() For FrameLimit = 1 To FrameTicks FrameTime = FrameTime + FramePeriod If FrameLimit = FrameTicks Then CaptureWorld EndIf dpitch = velpitch * 1/FPS dyaw = velyaw * 1/FPS droll = velroll * 1/FPS TurnEntity cube, dpitch, dyaw, droll UpdateWorld Next RenderWorld FrameTween If start_time < 0 Then start_time = MilliSecs() If MilliSecs() - start_time <= 1000 y = EntityYaw(cube) Else velyaw = 0 EndIf Text 0, 0, "Yaw = " + y Flip Wend Function Frame_Init() FramePeriod = 1000 / FPS FrameTime = MilliSecs () - FramePeriod End Function Function Frame_Capture() Repeat FrameElapsed = MilliSecs () - FrameTime Until FrameElapsed FrameTicks = FrameElapsed / FramePeriod FrameTween = Float (FrameElapsed Mod FramePeriod) / Float (FramePeriod) End Function
I want to have my entities to move in terms of velocities. The question is:
What is the velocity of Y-Axis, velyaw, in order to get the Cube rotated exactly 180 degrees within 1 second?
If you run the program you will see that I don't get the desired result setting the velyaw to 180 degrees/sec. OK I know that I am wrong but I don't know where!
Thanks