Simulate horizontal fan action
Blitz3D Forums/Blitz3D Programming/Simulate horizontal fan action
| ||
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 ! |
| ||
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. |
| ||
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 :) |
| ||
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. |
| ||
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 ! |
| ||
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. |
| ||
i've already tested that Chris ! |
| ||
I forgot to use EntityPickMode with the fan entity ! The linepick documentation is very poor !!! |
| ||
uhm... it's not really realistic ! : try this ! i really need some help to improve this ! |
| ||
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 ; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
| ||
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. |