@bmaczero
wow i see what you mean i got that code from an example TDK gave me back in April wen i saw stuck in coloring and rotating the cube
he gave me the code for rotating and he told me there were a few bugs with it, but unfortunately i left for a while and the thread closed before he ever figured out the rotation problem
@Sven B
I haven't tried that yet but i will soon. i just need to know will there be a way to make that code into steps kinda of like a i have so it shows the cube rotating slowly? heh i guess thats really my job to figure out, i gotta give it a better look when i have time
-and i don't see why i would have to alter my code at all other then adding the new commands because my code already calls the cube to rotate around the X-axis if its greater then or less then the Z coordinates I specified
*Edit I tried including that code into my project and i took off the extra checks with the if statement and all but now i cannot build the exe. i get an error that says Could not create (full directory path) my file is in
heres the new code same file included for download or download it form the post above
Set Display Mode 800,600,32
Sync On: Sync Rate 60: CLS 0
AutoCam Off
BackDrop On: Color BackDrop 0
#include "rotationfunctions.txt"
`Define Variables
CubeSize# = 360
CubeSideRight# = CubeSize#/2
CubeSideLeft# = 0-CubeSize#/2
CubeSideTop# = CubeSize#/2
CubeSideBottom# = 0-CubeSize#/2
SphereSize# = 20
SpherePosX# = 0.0
SpherePosY# = (CubeSize#/2.0)+(SphereSize#/2.0)
SpherePosZ# = 0.0
KeyValue = 0
`Create Objects
LimbCube(1,CubeSize#)
`Color The Six Sides
Color Limb 1,1,RGB(0,0,255)
Color Limb 1,2,RGB(255,0,0)
Color Limb 1,3,RGB(0,255,0)
Color Limb 1,4,RGB(0,255,255)
Color Limb 1,5,RGB(255,0,255)
Color Limb 1,6,RGB(255,255,0)
Position Object 1,0,0,0
Make Object Sphere 2,SphereSize#
`Set Camera
Position Object 2,0,CubeSize#/2+SphereSize#/2,0
Position Camera 0,500,-500:Point Camera 0,180,-150
`Main Loop
Do
`Allow For Constant Movement
If Upkey()=1 then KeyValue = 1
If Downkey()=1 then KeyValue = 2
If Rightkey()=1 then KeyValue = 3
If Leftkey()=1 then KeyValue = 4
If KeyValue = 1 then Move Object 2,1
If KeyValue = 2 then Move Object 2,-1
If KeyValue = 3 then Move Object Right 2,1
If KeyValue = 4 then Move Object Left 2,1
`Update Sphere Position To Variables
SpherePosX# = Object Position X(2)
SpherePosZ# = Object Position Z(2)
`ROTATE CUBE
If SpherePosZ# > CubeSideTop# then Gosub CubeRotateTop
If SpherePosZ# < CubeSideBottom# then Gosub CubeRotateBottom
If SpherePosX# > CubeSideRight# then Gosub CubeRotateRight
If SpherePosX# < CubeSideLeft# then Gosub CubeRotateLeft
Sync
Loop
CubeRotateTop:
Hide Object 2
For N=1 To 30
Rotate_GX(1,-3)
Sync
Next N
SpherePosZ# = CubeSideBottom#
Position Object 2,SpherePosX#,SpherePosY#,SpherePosZ#
Show Object 2
Return
CubeRotateBottom:
Hide Object 2
For N=1 To 30
Rotate_GX(1,3)
Sync
Next N
SpherePosZ# = CubeSideTop#
Position Object 2,SpherePosX#,SpherePosY#,SpherePosZ#
Show Object 2
Return
CubeRotateRight:
Hide Object 2
For N=1 To 30
Rotate_GZ(1,3)
Sync
Next N
SpherePosX# = CubeSideLeft#
Position Object 2,SpherePosX#,SpherePosY#,SpherePosZ#
Show Object 2
Return
CubeRotateLeft:
Hide Object 2
For N=1 To 30
Rotate_GZ(1,-3)
Sync
Next N
SpherePosX# = CubeSideRight#
Position Object 2,SpherePosX#,SpherePosY#,SpherePosZ#
Show Object 2
Return
Function LimbCube(CubeNum,Size#)
Offset#=Size#/2 : MeshNum=2000 : PlainNum=2000
Make Object Cube CubeNum,Size#
Make Object Plain PlainNum,Size#,Size#
Make Mesh From Object MeshNum,PlainNum
Add Limb CubeNum, 1, 2000: Offset Limb CubeNum,1,0,0,0-Offset#
Add Limb CubeNum, 2, 2000: Rotate Limb CubeNum,2,0,90,0: Offset Limb CubeNum,2,0-Offset#,0,0
Add Limb CubeNum, 3, 2000: Rotate Limb CubeNum,3,0,180,0: Offset Limb CubeNum,3,0,0,Offset#
Add Limb CubeNum, 4, 2000: Rotate Limb CubeNum,4,0,270,0: Offset Limb CubeNum,4,Offset#,0,0
Add Limb CubeNum, 5, 2000: Rotate Limb CubeNum,5,270,0,0: Offset Limb CubeNum,5,0,0-Offset#,0
Add Limb CubeNum, 6, 2000: Rotate Limb CubeNum,6,90,0,0: Offset Limb CubeNum,6,0,Offset#,0
Set Object Cull CubeNum,0
Delete Mesh MeshNum
Delete Object PlainNum
Hide Limb CubeNum,0
EndFunction
Edit*
Turns out its a computer problem
the folder the file is saved is restricted some how it wont let me edit anything it or even delete anything. even though i have done nothing to that folder. oh well i just saved everything into another folder and it worked
the new codes ran perfectly
@Sven B if i go into that file and just take out the two functions i need will that work and is it allowed need to know in advanced
thank you very much for everything i've been having this problem for ever and now its fixed