Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Generated from: https://wiki.secondlife.com/wiki/LlSetPrimMediaParams
- Hello! To make the media displayed on a prim face automatically scale to fit the dimensions of that face, you need to use an LSL script inside the prim and utilize the `llSetPrimMediaParams` function.
- The specific parameter you are looking for is `PRIM_MEDIA_AUTO_SCALE`. When this parameter is set to `TRUE`, it forces the media content (like your movie) to stretch or shrink to fill the entire texture area of the designated prim face, matching its aspect ratio.
- Here's how you can use it in a simple script:
- ```lsl
- // --- Script Start ---
- default
- {
- state_entry()
- {
- // --- Configuration ---
- // Replace 'your_face_number' with the actual face index you want the media on.
- // You can find the face number in the Edit window -> Texture tab.
- // Common faces are 0 for simple cubes, but check for complex prims.
- integer media_face = 0; // <-- CHANGE THIS to the correct face number
- // --- Set Media Parameters ---
- // This list sets the AUTO_SCALE parameter to TRUE (1).
- list media_params = [ PRIM_MEDIA_AUTO_SCALE, TRUE ];
- // Apply the settings to the specified face
- llSetPrimMediaParams(media_face, media_params);
- // Optional: You might also want to set other parameters like the URL here.
- // For example:
- // list more_params = [
- // PRIM_MEDIA_AUTO_SCALE, TRUE,
- // PRIM_MEDIA_CURRENT_URL, "http://your_movie_url.com",
- // PRIM_MEDIA_AUTO_PLAY, TRUE
- // ];
- // llSetPrimMediaParams(media_face, more_params);
- }
- // Optional: Add a touch event to easily reset or change media if needed
- touch_start(integer total_number)
- {
- // You could re-apply settings or change the URL on touch
- state_entry(); // Re-run the state_entry logic as a simple example
- }
- }
- // --- Script End ---
- ```
- **How to use this script:**
- 1. Create a new script inside the prim where you want to display the media (Content tab -> New Script).
- 2. Copy and paste the code above into the script window.
- 3. **Crucially, change the value of `media_face`** to the correct number for the face you are using. You can find this number by editing the prim, going to the "Texture" tab, and selecting the specific face; its number will be shown.
- 4. Save the script.
- Once the script is saved and running, it should apply the `PRIM_MEDIA_AUTO_SCALE` setting, and the media should automatically resize to fit the prim face without requiring you to scroll.
- **Important Notes:**
- * The `PRIM_MEDIA_AUTO_SCALE` parameter scales the *content* to fit the *texture space* on the prim face.
- * The parameters `PRIM_MEDIA_WIDTH_PIXELS` and `PRIM_MEDIA_HEIGHT_PIXELS` control the *resolution* (in pixels) of the media surface itself, not the automatic fitting to the prim's shape. While they can influence quality, `PRIM_MEDIA_AUTO_SCALE` is the setting that directly addresses your aspect ratio fitting problem.
- * Make sure the texture on the face itself is aligned properly (e.g., covering the whole face). You can adjust texture repeats and offsets in the Edit -> Texture tab if needed, although `PRIM_MEDIA_AUTO_SCALE` usually handles the content scaling correctly regardless of texture repeats, as it scales to the *entire* face area designated for media.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement