So, I have a windzone, and I have a player cam.
On the player cam I have a screen effect of water drips for rain. I am able to push the drips to the left or the right.
I would like the wind to affect the drips and push them, depending on which directions the player and the windzone are facing relative to eachother.
I’ve tried working off the euler angles but the wrap and the shape of the effect I’m trying to create makes it annoyingly complicated. Is there a particular method that handles the wrap? Is there a better method to use without eulers when working off rotations?
Yeah, quaternions.
As for specifics for your problem, will need more information. You talk about pushing relative to wind and some other stuff, but honestly I have no idea what you’re actually describing. In what way does rotation have to do with linear motion of pushing?
It’s a 3D game.
The rotation of the player camera relative to the wind direction should affect how much the wind pushes the drops, and in what direction it pushes them.
The more the player faces the wind, the stronger the effect should be.
If the wind is at their back, and they’re facing in exactly the same direction as the wind, the wind shouldn’t affect the drop direction. If they’re facing the wind but slightly to the right, the drips should push right. If they’re facing the wind but slightly to the left, the drips should push left.
Wait, I’ll post a vid to better illustrate.
So I hacked some code to make it work from a particular direction. I’d like to be able to move the wind rotation though. Not sure how. Possible remapping rotations to handle the wrap… Maybe there is a better way.
CurrAngleDiff = Mathf.Abs (WindzoneObject.transform.rotation.eulerAngles.y - gameObject.gameObject.transform.rotation.eulerAngles.y);
//Are we facing the wind at all?
if ((CurrAngleDiff < 90) || (CurrAngleDiff > 270)) {
//NOT FACING
//Which side is the wind blowing?
if (CurrAngleDiff > 270) {
NewAngle = (360 - CurrAngleDiff);
} else {
NewAngle = CurrAngleDiff * -1;
}
} else {
//FACING
if (CurrAngleDiff <= 180) {
//-90
NewAngle = WindMin;
} else {
//90
NewAngle = WindMax;
}
}
HeadBobAngle = HeadBobAngle * 4;
NewAngle = (((NewAngle / 80) * (Wind.windMain * WindStrengthEffectModifier)) / WindEffectWeakenModifier) * 6;
NewAngle = (NewAngle + HeadBobAngle) / 10;
LiqScript.TrailConstantAngle = NewAngle;
As you can see, it’s completely tied to these specific angles, representing the quadrants of the 360 rotation.
That works because the current wind direction/rotation is 0.
quick head movements (headbob) have 40% impact on the new angle when the wind effect is active. That can be ignored as it has nothing to do with the wind.