I would like to know if anyone could explain with example how to use gltf transformation in script in a predictable way.
Here a toy script I made.
string cross_tex = "fabbb720-cb4c-f8a4-ba9b-b5c83451d73d";
string cross_mat = "21041079-6b74-3d0b-4092-89be5d4b3a84";
vector scl;
scale() {
scl = <0.1 + llFrand(1.8), 0.1 + llFrand(1.8), 0>;
llSetLinkPrimitiveParamsFast(0, [PRIM_TEXT, (string)scl, <1,0,1>, 1]);
}
default {
state_entry() {
scale();
llSetLinkPrimitiveParamsFast(0, [
PRIM_TEXTURE, 0, cross_tex, scl, ZERO_VECTOR, 0,
PRIM_RENDER_MATERIAL, 1, cross_mat,
PRIM_RENDER_MATERIAL, 2, cross_mat,
PRIM_RENDER_MATERIAL, 3, cross_mat,
PRIM_RENDER_MATERIAL, 4, cross_mat,
PRIM_RENDER_MATERIAL, 5, cross_mat
]);
}
touch(integer num_detected) {
integer link = llDetectedLinkNumber(0);
integer side = llDetectedTouchFace(0);
//llOwnerSay("side: " + (string)side);
vector st = llDetectedTouchST(0);
if (side == 0) {
vector zo = <0.5 * scl.x, 0.5 * scl.y, 0> + <-st.x * scl.x, -st.y * scl.y, 0>;
llSetLinkPrimitiveParamsFast(link, [
PRIM_TEXTURE, side, cross_tex, scl, zo, 0
]);
}
else {
vector zo = st;
llSetLinkPrimitiveParamsFast(link, [
PRIM_GLTF_BASE_COLOR, side, "", scl, zo, "", "", "", "", "", ""
]);
}
}
touch_end(integer num_detected) {
scale();
}
}
If you compile it in a prim cube, you can click drag the top face and the cross will chase your mouse.
How can we get the same result on the side faces that use gltf?