By this, I mean that the skybox viewer actor will be slightly affected by the player's movement, giving a sense of depth to the things in the skybox besides the common, non-moving skyboxes we are currently subjected to in the ZDoom engine. It's only a few lines of code, but is easily modified to fit your needs and be implemented in your own maps.
- Code: Select all • Expand view
Script # ENTER
{
While(TRUE)
{
SetActorPosition(S, GetActorX(0)/A+X*65536, GetActorY(0)/B+Y*65536, GetActorZ(0)/C+Z*65536, 0);
Delay(1);
}
}
Script Variable Breakdown:
# = Script number or name
S = Skybox Viewpoint Tag
A = X-Axis Sensitivity Modifier
X = Difference between Player and Skybox Viewpoint in map units on the X-Axis(Can be negative, but not equal to zero)
B = Y-Axis Sensitivty Modifier
Y = Difference between Player and Skybox Viewpoint in map units on the Y-Axis (Can be negative, but not equal to zero)
C = Z-Axis Sensivity Modifier
Z = Difference between Player and Skybox Viewpoint in map units on the Z-Axis (Can be negative, but not equal to zero)
For example:
- Code: Select all • Expand view
Script 1 ENTER
{
While(TRUE)
{
SetActorPosition(1, GetActorX(0)/25+960*65536, GetActorY(0)/25-64*65536, GetActorZ(0)/25-50*65536, 0);
Delay(1);
}
}
The Skybox Viewpoint's tag is 1. Variables A, B, C have all been set to 25. The closer these variables are to zero, the more loose the skybox viewpoint's movement is, the higher the values, the movement will be more stiff. Variables X, Y, Z have the difference between the Player actor and the Skybox Viewpoint. Please consult the image below for a visual explanation of variables X and Y.
Spoiler:
The number 65536 is for conversion purposes and should never be changed.
NOTE: When placing a Skybox camera, it MUST be set to an angle of zero. Any other angle causes the alignment to be off.(Although setting it to, say, 180 could cause an interesting effect in void-esque maps.)
Here is an example WAD showcasing the script: http://www.mediafire.com/?92inzehbrp394ts
I will edit this post as it needs to be, to fix errors or add on to answer other's questions that they may have. In the meantime, enjoy the example and code. Please, if you have a question, ask.
P.S.- Since I have done this script, all previous skyboxes (All of the standard, non-moving ones) no longer look right to me. I will not be held accountable if this happens to you as well.
