Jump to content

I need an eye twitching script please


Hikaru Yamamoto
 Share

Recommended Posts

Hello, I make mesha avatars and I'm looking for a script that will make a sphere twitch like an eye so I can use them on my avatars to make them more lifelike. I will need it full perm of course. If you can please provide me with a script, make one for me, or point me to where I can buy one, it will be much appreciated. Please IM me or reply here.

Link to comment
Share on other sites

Aha!

The wiki's llLookat() page contains a script for making an object look at the closest avatar. If you drop that script into a prim eye, it may do what you wish. If you want saccade movement, you might add a small random amount to the X and Y axis components of the vector that's being added to the target avatar's detected position.

Here's the unmodified script from that page...

// Same as above, but for use inside a child prim or the root of an attachment.// Make the child or attachment look at nearest Avatar. default{    state_entry()    {        llSensorRepeat("", "", AGENT, 20.0, PI, 0.2);    }     sensor(integer total_number)    {        vector p = llGetPos();        llLookAt(p + (llDetectedPos(0) + <0.0, 0.0, 1.0> - p) / llGetRootRotation(), 3.0, 1.0);    }}

 

Here's the script with the addition of random saccade...

// Same as above, but for use inside a child prim or the root of an attachment.// Make the child or attachment look at nearest Avatar.
integer saccadeX = 0.1;
integer saccadeY = 0.1;
default{ state_entry() { llSensorRepeat("", "", AGENT, 20.0, PI, 0.2); } sensor(integer total_number) { vector p = llGetPos(); llLookAt(p + (llDetectedPos(0) + <llFrand(saccadeX), llFrand(saccadeY), 1.0> - p) / llGetRootRotation(), 3.0, 1.0); }}

 I have not tried this, so it may not compile, and if it does, it may not work. But it's a start.

Good luck!

Link to comment
Share on other sites

Don't thank me yet. It may not do what you want. I have no idea whether the saccade values (which are offsets from the X/Y position of the avatar) are proper values, nor whether the random movement will look at all natural. I also don't know where the eye will point if there is no avatar in range. It might just roll back into the head! You may have to invite a friend over to give the script someone to look at. That wiki page I linked also has the script for a non-attached prim. You might try putting that script in a sphere rezzed on the ground to see how it works, it'll be looking at you, and won't require a second avatar.

But as I said, it's a start.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...