Ooops
January 16, 2021, 06:02:33 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 - Effects
»
[bb] Highspeed distort by H. T. U. [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] Highspeed distort by H. T. U. [ 1+ years ago ] (Read 517 times)
BlitzBot
Jr. Member
Posts: 1
[bb] Highspeed distort by H. T. U. [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:39 AM »
Title :
Highspeed distort
Author :
H. T. U.
Posted :
1+ years ago
Description :
Two months ago, I ran into a problem where a camera needed to be inside a character's collision radius but still get a good view of it's surroundings. I set CameraZoom to a value between 0 and 1. This increased the view but caused distortion. I still havn't solved that problem but used that technique to make this demo.
Code :
Code: BlitzBasic
Graphics3D
640
,
480
SetBuffer
BackBuffer
(
)
camera=
CreateCamera
(
)
PositionEntity
camera,
0
,
1
,-
5
light=
CreateLight
(
)
ship=
CreateSphere
(
)
ScaleEntity
ship,
0.5
,
0.5
,
2
Dim
back
(
1000
)
For
a=
1
To
1000
back
(
a
)
=
CreateSphere
(
)
PositionEntity
back
(
a
)
,
Rand
(
-
30
,
30
)
,
Rand
(
-
30
,
30
)
,
Rand
(
-
10
,
10000
)
EntityColor
back
(
a
)
,
Rand
(
0
,
255
)
,
Rand
(
0
,
255
)
,
Rand
(
0
,
255
)
Next
While
Not
KeyDown
(
1
)
If
KeyDown
(
200
)
speed#=speed#+
0.1
If
KeyDown
(
208
)
speed#=speed#-
0.1
If
KeyDown
(
13
)
Or
KeyHit
(
78
)
amount#=amount#+
0.1
If
KeyDown
(
12
)
Or
KeyHit
(
74
)
amount#=amount#-
0.1
MoveEntity
ship,
0
,
0
,speed#
If
EntityZ
(
ship
)
>
9000
PositionEntity
ship,
0
,
0
,
0
If
EntityZ
(
ship
)
<-
5
PositionEntity
ship,
0
,
0
,
9000
PositionEntity
camera,
EntityX
(
ship
)
,
EntityY
(
ship
)
,
EntityZ
(
ship
)
MoveEntity
camera,
0
,
1
,-
5
CameraZoom
camera,
1
/
(
amount#*speed#+
1
)
RenderWorld
Text
0
,
0
,
"Press + to increase distortion or - to decrease distortion (and zoom in)."
,
False
,
False
Flip
Wend
End
Comments :
Ace Killjoy(Posted 1+ years ago)
Nice.I may be able to use this.
Nate the Great(Posted 1+ years ago)
I find the least distortion when I set zoom to 1.6
H. T. U.(Posted 1+ years ago)
Well, I kindof gave up and gave the camera collisions, not exactly what I wanted but it looks ok.I still us this code for hyperfast spacecraft though.P.S. A zoom of 1.6 is normal for human vision.
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
3D Graphics - Effects
»
[bb] Highspeed distort by H. T. U. [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal