Difference between revisions of "Animation Adjustement to Avatar Height"
Jump to navigation
Jump to search
Cay Trudeau (talk | contribs) (We change avatar position upwards after sitting, according to avatar height) |
Cay Trudeau (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Animation Adjustement According to Avatar Height Snippet== | ===Animation Adjustement According to Avatar Height Snippet=== | ||
This is a piece of code, that is meant to be putted inside a changed event (what is initialized when avatar sits). | This is a piece of code, that is meant to be putted inside a changed event (what is initialized when avatar sits).<br><br> | ||
This snippet is for a prim that is AT THE FLOOR LEVEL. If you need a snipper for a chair, you need to adjust the parameters according. | This snippet is for a prim that is AT THE FLOOR LEVEL. If you need a snipper for a chair, you need to adjust the parameters according. | ||
Line 19: | Line 19: | ||
float avup = (adjustement + ( size.z/10)) + 0.08; // half of avatar + one tenth of avatar + your own tweak (depends on various things, so you have to test what works for you) | float avup = (adjustement + ( size.z/10)) + 0.08; // half of avatar + one tenth of avatar + your own tweak (depends on various things, so you have to test what works for you) | ||
llSetLinkPrimitiveParamsFast(agentlinknum,[PRIM_POS_LOCAL,<0,0,avup>,PRIM_ROT_LOCAL,llEuler2Rot( | llSetLinkPrimitiveParamsFast(agentlinknum,[PRIM_POS_LOCAL,<0,0,avup>,PRIM_ROT_LOCAL,llEuler2Rot(<0,0,0>)]); // here we move the avatar to the new position, the rotation part is the target rotation in euler | ||
</lsl> | </lsl> |
Latest revision as of 00:17, 15 April 2014
Animation Adjustement According to Avatar Height Snippet
This is a piece of code, that is meant to be putted inside a changed event (what is initialized when avatar sits).
This snippet is for a prim that is AT THE FLOOR LEVEL. If you need a snipper for a chair, you need to adjust the parameters according.
<lsl>
integer agentlinknum = llGetNumberOfPrims(); // when avatar sits it becomes the last child on the linkset
vector size = llGetAgentSize(llAvatarOnSitTarget()); // we measure the avatar size float adjustement = (size.z / 2 ); // size.z is avatar height, pelvis is halfway the avatar float avup = (adjustement + ( size.z/10)) + 0.08; // half of avatar + one tenth of avatar + your own tweak (depends on various things, so you have to test what works for you)
llSetLinkPrimitiveParamsFast(agentlinknum,[PRIM_POS_LOCAL,<0,0,avup>,PRIM_ROT_LOCAL,llEuler2Rot(<0,0,0>)]); // here we move the avatar to the new position, the rotation part is the target rotation in euler
</lsl>