I am making a solar system for experiment but I don't know how to do two or more planets go to different speeds, For Example, variable for mars w\CenterYawAdd#[5] = 1 and variable for earth w\CenterYawAdd#[3] = 2 . How Can I do those two body go to this differents speeds using TurnEntity. O perhaps there were a better way?
I apreciate help for to understanding this question easy for experts coders, but difficult to me actually.
My code:
I apreciate help for to understanding this question easy for experts coders, but difficult to me actually.
My code:
Graphics3D 640,480,16,2 SetBuffer BackBuffer() Global xx# Type system Field name$ [12] Field x# [12] Field y# [12] Field z# [12] Field CenterPitchAdd#[12] Field CenterYawAdd#[12] Field CenterRollAdd#[12] End Type ; variables types w.system = New system w\name$ [0] = "Sun" w\x#[0] = 0 w\y#[0] = 0 w\z#[0] = 20 w\CenterPitchAdd#[0] = 0 w\CenterYawAdd#[0] = 1 w\CenterRollAdd#[0] = 0 w\name$ [3] = "Earth" w\x#[3] = 0 w\y#[3] = 0 w\z#[3] = 5 w\CenterPitchAdd#[3] = 0 w\CenterYawAdd#[3] = 2 w\CenterRollAdd#[3] = 0 w\name$ [4] = "Moon" w\x#[4] = 0 w\y#[4] = 0 w\z#[4] = 5 w\CenterPitchAdd#[4] = 0 w\CenterYawAdd#[4] = 1 w\CenterRollAdd#[4] =0 w\name$ [5] = "Mars" w\x#[5] = 0 w\y#[5] = 0 w\z#[5] = 8 w\CenterPitchAdd#[5] = 0 w\CenterYawAdd#[5] = 1 w\CenterRollAdd#[5] =0 ; Entitys sun=CreateSphere(32) ScaleEntity sun, 2, 2, 2 EntityColor sun,255,255,0 earth=CreateSphere(32,sun) ScaleEntity earth, 1, 1, 1 EntityColor earth,0,255,0 moon=CreateSphere(32,earth) ScaleEntity moon, .5, .5, .5 EntityColor moon,100,100,100 mars=CreateSphere(32,sun) ScaleEntity mars, .7, .7, .7 EntityColor mars,255,0,0 camera=CreateCamera() lite = CreateLight() light=CreateLight(1) ;create ligth ; Main program While Not KeyDown( 1 ) ; Change position values depending on key pressed If KeyDown( 203 )=True Then For j=0 To 12 w\x#[j]=w\x#[j]-0.1 Next EndIf If KeyDown( 205 )=True Then For j=0 To 12 w\x#[j]=w\x#[j]+0.1 Next EndIf If KeyDown( 208)=True Then For j=0 To 12 w\y#[j]=w\y#[j]-0.1 Next EndIf If KeyDown( 200 )=True Then For j=0 To 12 w\y#[j]=w\y#[j]+0.1 Next EndIf If KeyDown( 44 )=True Then For j=0 To 12 w\z#[j]=w\z#[j]-0.1 Next EndIf If KeyDown( 30 )=True Then For j=0 To 12 w\z#[j]=w\z#[j]+0.1 Next EndIf LightColor lite,255,0,0 ; Position using position values PositionEntity sun,w\x#[0],w\y#[0],w\z#[0] PositionEntity earth,w\x#[3],w\y#[3],w\z#[3] PositionEntity moon,w\x#[4],w\y#[4],w\z#[4] PositionEntity mars,w\x#[5],w\y#[5],w\z#[5] PointEntity lite,moon ;light TurnEntity sun, w\CenterPitchAdd#[0], w\CenterYawAdd#[0], w\CenterRollAdd#[0] TurnEntity earth, w\CenterPitchAdd#[3], w\CenterYawAdd#[3], w\CenterRollAdd#[3] ; how can I to do mars go to different speed than earth ???? x#=x#+0.1 RotateEntity earth,0,x# ,0 RenderWorld Flip Wend