Download

Wind and Wind Cover

Hey Everyone

I have wind in my project and can change the direction as needed, but what I’m wanting to do, is find out how I can tell if player is shielded by the wind if they are behind a wall which should block the wind from the player if the player is up against it. I have included a little drawing of what I mean. I also only want the player to be shielded if they are a certain distance from the wall, approx 300 units, and any further than that, then they are no longer protected by the wall. Also, it shouldn’t matter what way the player is facing. This is an FPS character with just the arms and camera.

The wind direction is a float ranging from 0-360.

Now i’m sure i should be using some sort of Trace here but not sure which one and the best way to go about it . Any help would be greatly appreciated.

Thanks

Hi @Jimminy_Cricket

I would suggest you to search in the inverse direction of the wind, from the player.
if it reaches something.

Lets say the wind is set like in your image ,
you can consider it a 90° or, as i prefer, 300,0,0 (x,y,z) (wind vector)
From this you can get the player world location and add it the inverse vector Wind.
So Player position -300,0,0

Now you can raycast or linetrace or whetever…
to check if in this splace there is at least an actor that can shiedl you from the wind

2 Likes

Thanks for the response. Just one thing in regards to what you mentioned. You used the example of 90 degrees being vector 300,0,0.
So what is the math behind turning that 90 degrees into that vector value? That way once i know how you convert that float value into the vector value i should be able to implement what you mentioned.

Thanks.

EDIT: I think i got it. Just got to do some more testing.

EDIT 2: So I can’t get this to work. So I have the Direction as a vector, but I’m just not sure how I do a line trace towards that vector from the player for about 300 units in length. Please help if you can. Thanks.

Hi !

Why don’t you just look for actors around your player with a sphereTrace, then get a look at vector from your player to this actor detected ( here the wall), and the distance to it, and if the look at vector is opposite to the wind direction (with a kind of acceptance angle) : then your player is protected. ( And managed the distance in a second time)
You just need to convert your wind direction from 0-360 to a world rotation on the floor axis
Maybe it should work that way ?

I can look into it, but it seems more complicated than it should be. I was hoping there was an easy way to just do a line trace from the players location to a vector location (wind direction), but make it only go for a limited distance from from the player. If it hits anything then that’s all I need for now. But I’m just not sure how I perform a line trace from the players location to a specific direction. I need the landscape to also block the line trace.

Oh yeah you’re actually right, that’s way more simple in fact. What causes you trouble here ?

I’m just not sure how I do a line trace from the player in the direction the wind is coming from. The wind direction is a float from 0-360 degrees. I can use that and make vector and so I get the direction as a vector.

What I don’t know how to do is now perform a line trace from the player in the direction of that vector. That is basically all i want to do.

I might just give up on it for a while and look at other ways to accomplish what I need to.

EDIT: Looks like I was making some silly mistakes on my end and I seem to have it working now. Sorry to bother everyone and thanks for your help guys.

Make a 2d vector.
W = wind direction in degree
x = sin W
y= cos W
Then multiply for distance

Ex : 90° wind :
vector : ( 1,0) x 300 ) this is what you have to add to your character position to have your end position

1 Like

Thanks Hdubs. That does what I need.I can finally move on from this problem :slight_smile: