OsSetTerrainTextureHeight: Difference between revisions
From OpenSimulator
Jump to navigationJump to search
imported>Djphil No edit summary |
No edit summary |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{osslfunc | {{osslfunc | ||
|function_syntax= | |function_syntax= osSetTerrainTextureHeight(integer corner, float low, float high) | ||
|csharp_syntax= | |csharp_syntax= | ||
|description=Set the terrain texture height for the estate. The corner values are: 0 (Southwest), 1 (Southeast), 2 (Northwest), 3 (Northeast). The values low and high are float values for the altitude measured in meters. | |description=Set the terrain texture height for the estate. The corner values are: 0 (Southwest), 1 (Southeast), 2 (Northwest), 3 (Northeast). The values low and high are float values for the altitude measured in meters. | ||
| Line 23: | Line 23: | ||
} | } | ||
</source> | </source> | ||
|additional_info= | |||
<source lang = "lsl"> | |||
// Terrain elevation animation | |||
float gTimerInterval = 5.0; // Timer interval in seconds | |||
float gTimerDelay = 5.0; // Start the timer after 5 seconds | |||
float gMinHeight = 5.0; | |||
float gMaxHeight = 55.0; | |||
float gStep = 1.0; | |||
integer gDirection = 1; // 1 for ascent, -1 for descent | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
llSetTimerEvent(gTimerDelay); | |||
} | |||
timer() | |||
{ | |||
// Set the height of the current terrain texture | |||
osSetTerrainTextureHeight(0, gMinHeight, gMaxHeight); | |||
osSetTerrainTextureHeight(1, gMinHeight, gMaxHeight); | |||
osSetTerrainTextureHeight(2, gMinHeight, gMaxHeight); | |||
osSetTerrainTextureHeight(3, gMinHeight, gMaxHeight); | |||
// Change the min and max height for the next interval | |||
gMinHeight += gStep * gDirection; | |||
gMaxHeight += gStep * gDirection; | |||
// Check and change the direction upon reaching the maximum or minimum value | |||
if (gMinHeight <= 5.0 || gMaxHeight >= 65.0) | |||
{ | |||
gDirection *= -1; // Reverse the direction | |||
gMinHeight += gStep * gDirection; // Correct the min and max height | |||
gMaxHeight += gStep * gDirection; | |||
} | |||
// Set the timer for the next interval | |||
llSetTimerEvent(gTimerInterval); | |||
} | |||
} | |||
</source> | |||
|additional_info=This function was added in 0.7.4-post-fixes | |||
}} | }} | ||
Latest revision as of 06:58, 2 January 2024
osSetTerrainTextureHeight(integer corner, float low, float high)
| |
| Set the terrain texture height for the estate. The corner values are: 0 (Southwest), 1 (Southeast), 2 (Northwest), 3 (Northeast). The values low and high are float values for the altitude measured in meters. | |
| Threat Level | High |
| Permissions | ESTATE_MANAGER,ESTATE_OWNER |
| Extra Delay | 0 seconds |
| Example(s) | |
// Default Terrain Textures by djphil 2018
default
{
state_entry()
{
osSetTerrainTexture(0, "b8d3965a-ad78-bf43-699b-bff8eca6c975");
osSetTerrainTextureHeight(0, 10.0, 60.0);
osSetTerrainTexture(1, "abb783e6-3e93-26c0-248a-247666855da3");
osSetTerrainTextureHeight(1, 10.0, 60.0);
osSetTerrainTexture(2, "179cdabd-398a-9b6b-1391-4dc333ba321f");
osSetTerrainTextureHeight(2, 10.0, 60.0);
osSetTerrainTexture(3, "beb169c7-11ea-fff2-efe5-0f24dc881df2");
osSetTerrainTextureHeight(3, 10.0, 60.0);
}
}
// Terrain elevation animation
float gTimerInterval = 5.0; // Timer interval in seconds
float gTimerDelay = 5.0; // Start the timer after 5 seconds
float gMinHeight = 5.0;
float gMaxHeight = 55.0;
float gStep = 1.0;
integer gDirection = 1; // 1 for ascent, -1 for descent
default
{
state_entry()
{
llSetTimerEvent(gTimerDelay);
}
timer()
{
// Set the height of the current terrain texture
osSetTerrainTextureHeight(0, gMinHeight, gMaxHeight);
osSetTerrainTextureHeight(1, gMinHeight, gMaxHeight);
osSetTerrainTextureHeight(2, gMinHeight, gMaxHeight);
osSetTerrainTextureHeight(3, gMinHeight, gMaxHeight);
// Change the min and max height for the next interval
gMinHeight += gStep * gDirection;
gMaxHeight += gStep * gDirection;
// Check and change the direction upon reaching the maximum or minimum value
if (gMinHeight <= 5.0 || gMaxHeight >= 65.0)
{
gDirection *= -1; // Reverse the direction
gMinHeight += gStep * gDirection; // Correct the min and max height
gMaxHeight += gStep * gDirection;
}
// Set the timer for the next interval
llSetTimerEvent(gTimerInterval);
}
}
| |
| Notes | |
| This function was added in 0.7.4-post-fixes | |