Simulate horizontal fan action

Blitz3D Forums/Blitz3D Programming/Simulate horizontal fan action

hub(Posted 2003) [#1]
Hi !

I need to simulate a classic horizontal fan action into my game. (you know, when the player jumps at the fan proximity the character 'fly')

But i don't know exactly how to do the job ! So, have you some ideas about the best and easier method to implement this ?



I post here a test code sample to show you my current test scene !

Source and media here (118Ko)

Many thanks for your help !


Sunteam Software(Posted 2003) [#2]
You could have an invisible cylinder setup with collision but with no auto-action so that when you get a collision response you can then apply the wind vector to your man.


Ross C(Posted 2003) [#3]
how about doing a line pick downwards only when the player is jumping to see if the player is above the fan. if he is then apply the wind to him. should work fine :)


jhocking(Posted 2003) [#4]
I was about to recommend the linepick down. A LinePick down from the player every frame is useful for all sorts of other things anyway. It is always nice to know what is below the character, even when the character is in midair.


hub(Posted 2003) [#5]
Thanks !!! I've used 'linepick' into my program but this seems not work !! Do you see where is the error ?

	
EntityPicked = LinePick (EntityX#(Player), EntityY#(Player), EntityZ#(Player), 0,2.0,0)

If EntityPicked = Fan Then
	RuntimeError "Founded !!!"
End If


Modified bb file here !


big10p(Posted 2003) [#6]
I haven't used LinePick yet but I think you need to change that 2.0 value to -2.0 to make the LinePick point down instead of up.


hub(Posted 2003) [#7]
i've already tested that Chris !


hub(Posted 2003) [#8]
I forgot to use EntityPickMode with the fan entity !
The linepick documentation is very poor !!!


hub(Posted 2003) [#9]
uhm... it's not really realistic ! : try this !
i really need some help to improve this !


Shambler(Posted 2003) [#10]
try this tweak...

; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

EntityPicked = LinePick (EntityX#(Player), EntityY#(Player), EntityZ#(Player), 0,-3-Rnd(1),0)
If EntityPicked = Fan Then
y_vel#=y_vel#+0.025
End If

; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


Bot Builder(Posted 2003) [#11]
y_vel#=y_vel#+1/((EntityY#(Player)-PickedY())^2/.75)


How about this? Of course, no fan is realisticly going to lift a person unless specially designed with a wind tunnel, so you can't really say that a fan is realistic. Anyway, this is a fan that has exponentially less effect farther away, giving more realism. Change the ".75" to modify the fan velocity and fiddle with the "1" for the overall amplitude.