Rain acting weird?

Blitz3D Forums/Blitz3D Beginners Area/Rain acting weird?

Guy Fawkes(Posted 2010) [#1]
I found this demo in the archives, and was wondering why when you move backwards, the rain doesn't follow u exactly as it is when ur standing still. how can i fix this?




_PJ_(Posted 2010) [#2]
The 'strangeness' is only due to the movement being in too large steps compared to the rain (i.e. size of rain sprites and frequency of them falling) Lowering the movement steps (from 1 to .5) for example, is one possible solution:
Lines 168 - 171
	If KeyDown(200) Then MoveEntity camera, 0, 0, 1
	If KeyDown(208) Then MoveEntity camera, 0, 0,-1
	If KeyDown(203) Then TurnEntity camera, 0, 2, 0
	If KeyDown(205) Then TurnEntity camera, 0,-2, 0


alernatively, you can generate more rain but this rapidly affects visibility and will cause slower rendering. To do this, change the rain ratio value for 'maxdist#' in line 175 (initially 20)
UpdateRain3D(camera,20)

[/code]


Guy Fawkes(Posted 2010) [#3]
fixed thx malice lol


Nate the Great(Posted 2010) [#4]
edit: malice beat me to it

well the rain is always spawned right in front of the camera, when you move forward, it is spawned in front of the camera and the camera moves into it, when the player moves back, it is spawned in front of the camera and the player moves away from it so it looks like it works for going forwards but not backwards.

here is a hacky fix




Guy Fawkes(Posted 2010) [#5]
how would i make it so that the rain stays in the same view of the camera no matter HOW fast my camera/player will be? can't i just add the speed of the moving camera to the positionentity of the rain xyz?


_PJ_(Posted 2010) [#6]
I think I know what you mean, and Nate's changes:

(~ Line 280ish)
r3d\x = EntityX(cam,True)+Rnd(-40,40); - (Sin(EntityYaw(cam,True)+d2)*d)
			r3d\y = EntityY(cam,True) + d
			r3d\z = EntityZ(cam,True)+Rnd(-40,40); + (Cos(EntityYaw(cam,True)+d2)*d)

Fixes the rainfall around the camera each update. Try it :)


Guy Fawkes(Posted 2010) [#7]
um, it did the same thing o.o


Guy Fawkes(Posted 2010) [#8]
weird...


Guy Fawkes(Posted 2010) [#9]
i tried it malice, it didn't work.


Nate the Great(Posted 2010) [#10]
rez,

my code works as is for me, I havent tried malice's yet but if you could describe what doesnt work about my code, please do tell...


Guy Fawkes(Posted 2010) [#11]
the rain isn't following the player the same way when at a fast speed.


_PJ_(Posted 2010) [#12]
Nate's solution is 'better' than mine, to be honest. Both in terms of effect and accuracy.

What kind of speeds are you talking about?
as in
If KeyDown(200) Then MoveEntity camera, 0, 0, 2
;...
If KeyDown(200) Then MoveEntity camera, 0, 0, 4
;...
If KeyDown(200) Then MoveEntity camera, 0, 0, 16
;...
If KeyDown(200) Then MoveEntity camera, 0, 0, 128
???


Guy Fawkes(Posted 2010) [#13]
the speed of the rain


Drak(Posted 2010) [#14]
He meant how fast are you moving the player. How many blitz units does the player move forward each frame?


_PJ_(Posted 2010) [#15]
Well if you're changing the 'speed of the rain', then of course it wont be the same!

How are you doing this? Changing
RainSpeed# = 3.0

What sort of values are you using.
it's a bit silly to post that something isn;'t working 'right' when you've changed it, without explaining what it is you've changed!