March 08, 2021, 12:39:30 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
3D Graphics - Maths
»
[bb] chaos cube by Vignoli [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] chaos cube by Vignoli [ 1+ years ago ] (Read 608 times)
BlitzBot
Jr. Member
Posts: 1
[bb] chaos cube by Vignoli [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:39 AM »
Title :
chaos cube
Author :
Vignoli
Posted :
1+ years ago
Description :
This program makes an entity rotate around coordinates 0,0,0 but using the theory of chaos.
Usefull for 3d games in space.
Code :
Code: BlitzBasic
; chaos cube
chn=
30
; change this for more or less chaos
Graphics3D
800
,
600
,
32
,
2
SetBuffer
BackBuffer
(
)
SeedRnd
MilliSecs
(
)
camera=
CreateCamera
(
)
AmbientLight
200
,
200
,
200
PositionEntity
camera,
0
,
0
,-
300
Dim
ang
(
chn,
3
)
Dim
sens
(
chn,
3
)
Dim
speed#
(
chn,
3
)
For
i=
1
To
chn
For
j=
1
To
3
ang
(
i,j
)
=
Rand
(
0
,
359
)
sens
(
i,j
)
=
Rand
(
0
,
1
)
If
sens
(
i,j
)
=
0
Then
sens
(
i,j
)
=-
1
speed#
(
i,j
)
=
Rand
(
5
,
200
)
speed#
(
i,j
)
=speed#
(
i,j
)
/
10.0
Next
Next
cube=
CreateCube
(
)
ScaleEntity
cube,
10
,
5
,
20
Repeat
If
KeyDown
(
1
)
Then
End
PositionEntity
cube,
0
,
0
,
0
For
i=
1
To
chn
RotateEntity
cube,ang
(
i,
1
)
,ang
(
i,
2
)
,ang
(
i,
3
)
MoveEntity
cube,speed#
(
i,
1
)
,speed#
(
i,
2
)
,speed#
(
i,
3
)
For
j=
1
To
3
ang
(
i,j
)
=ang
(
i,j
)
+
Int
(
sens
(
i,j
)
*speed#
(
i,j
)
)
While
ang
(
i,j
)
<
0
ang
(
i,j
)
=ang
(
i,j
)
+
360
Wend
While
ang
(
i,j
)
>
359
ang
(
i,j
)
=ang
(
i,j
)
-
360
Wend
If
KeyDown
(
1
)
Then
End
Next
Next
UpdateWorld
RenderWorld
Color
255
,
255
,
255
Text
0
,
0
,
"Push [Return] to randomize the chaos"
Flip
If
KeyDown
(
28
)
SeedRnd
MilliSecs
(
)
For
i=
1
To
chn
For
j=
1
To
3
ang
(
i,j
)
=
Rand
(
0
,
359
)
sens
(
i,j
)
=
Rand
(
0
,
1
)
If
sens
(
i,j
)
=
0
Then
sens
(
i,j
)
=-
1
speed#
(
i,j
)
=
Rand
(
5
,
200
)
speed#
(
i,j
)
=speed#
(
i,j
)
/
10.0
Next
Next
While
KeyDown
(
28
)
:
Wend
EndIf
tt1=
MilliSecs
(
)
While
MilliSecs
(
)
-tt1<
50
If
KeyDown
(
1
)
Then
End
Wend
Forever
End
Comments :
none...
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
3D Graphics - Maths
»
[bb] chaos cube by Vignoli [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal