Elexis Reinard 0 Posted September 28, 2011 Share Posted September 28, 2011 Hello, I'm looking for a way to define the rotation of an avatar. My goal is to be able to rotate the avatar so that it's parallel to the ground.I wasn't successful with an invisible rotated prim to stand on... what could you suggest me please? Thanks! Link to post Share on other sites
PeterCanessa Oh 427 Posted September 28, 2011 Share Posted September 28, 2011 It depends on when you want the avatar to be parallel to the ground. For 'free' movement I'd suggest using an animation, possibly the built-in fly/fly-slow; http://wiki.secondlife.com/wiki/Internal_Animations If you want them sitting on something then set the rotation in llSitTarget() Link to post Share on other sites
Rolig Loon 27,288 Posted September 28, 2011 Share Posted September 28, 2011 You can't move an avatar directly using LSL, so the only way to do it is to rotate something that the avatar is linked to. Treat it as a poseball exercise, as Peter suggests, and set the rotation in llSetTarget. Unfortunately, that means your avatar will be immobile until s/he unlinks again, so you'll have to do any other movements either by triggering animations or by moving that "poseball". Link to post Share on other sites
Rufus Darkfold 21 Posted September 28, 2011 Share Posted September 28, 2011 Rolig Loon wrote: You can't move an avatar directly using LSL, so the only way to do it is to rotate something that the avatar is linked to. If the avatar is linked to something (sitting on it) you can move it directly with PRIM_POSITION like any other child prim. Link IDs for seated avatars start one after the highest real child prim. PRIM_ROTATION works too, and I assume PRIM_ROT_LOCAL would as well, though I haven't tested it yet. Interestingly, the avatar is not subject to the normal linking-distance rules here. I have been able to move my avatar 1000 meters away from the root prim, and to explore underground. I have only tested this sitting on a non-physical object. I'm building a subway. Link to post Share on other sites
Rolig Loon 27,288 Posted September 28, 2011 Share Posted September 28, 2011 The point is still that you can't move the avatar unless it is linked to something. Then your script can manipulate the linkset. Link to post Share on other sites
Kayaker Magic 8 Posted September 29, 2011 Share Posted September 29, 2011 I have rotated and positioned avatars linked to physical objects using PRIM_ROTATION etc. My application is building kayaks and other vehicles that can paddle off-sim into the Void Sea. I have discovered that the Physics Engine gets very confused when the avatar is over about 40 meters away from the root prim and off-sim. At 40 meters or more the whole build starts taking off and flying great distances (greater than 256 meters) before snapping back to where it belongs. Link to post Share on other sites
Nescolet 5 Posted April 2, 2013 Share Posted April 2, 2013 Is there a way to get an avatar rotation coordinates, like if it were a prim? I tried attaching a cube to an avi's center but when I click edit on the cube the rotation values show all zeros. Link to post Share on other sites
Rolig Loon 27,288 Posted April 2, 2013 Share Posted April 2, 2013 Sure. Drop this in a prim and click it. default{ touch_start(integer total_number) { llSensor("","",AGENT_BY_LEGACY_NAME,10.0,PI); } sensor(integer num) { llSay(0,llDetectedName(0) + " is facing " + (string)llDetectedRot(0) + ". (That is, " + (string)(llRot2Euler(llDetectedRot(0))*RAD_TO_DEG) + "."); }} It won't work if it's attached to the avatar, but you could modify it to be a follower...... Link to post Share on other sites
Innula Zenovka 3,538 Posted April 2, 2013 Share Posted April 2, 2013 According to the wiki article on rotation, which is accurate as far as I know, llGetRot() should return that avatar's rotation when called in the root prim of an attachment. Of if you use llGetRootRotation() it shouldn't matter whether it's in the root prim or one of the children. Link to post Share on other sites
Nescolet 5 Posted April 2, 2013 Share Posted April 2, 2013 Rolig, thanks for your tip, I added your code to the second follower script found here and it seems to report only the rotation in one axis like this Resident is facing <0.00000, 0.00000, 0.53724, 0.84343>. (That is, <0.00000, 0.00000, 64.99147>. When I trigger an animation applied to the avi inworld that lays my avi sideways on the floor the rotation reported is the same as above. I'd like to have have a report on what is the rotation of the avi when an animation is applied to it inworld. Link to post Share on other sites
Nescolet 5 Posted April 2, 2013 Share Posted April 2, 2013 Innula, I tried the following script put on a cube attached to my spine: default { touch_start(integer total_number) { llSay(0,(string)(llRot2Euler(llGetRot())*RAD_TO_DEG)); } } But the script seems to report only the rotation in one axis (the last one): <0.00000, 0.00000, -96.84402> And it returns the same value if I apply an inworld animation to the avi making it lay on the floor on its side. Link to post Share on other sites
Innula Zenovka 3,538 Posted April 2, 2013 Share Posted April 2, 2013 Yes, you are getting the results I would expect. When you are standing up, you will only be rotating on your z axis, at least normally. When you play an animation, the sim doesn't know about it -- it knows it's sent some instructions to the computers of everyone in draw distance about how to draw your avatar (laying down, standing on its head, whatever) but it has no idea what those instructions are. As far as the sim is concerned, when you're playing an animation, you are are just standing (or sitting) there motionless. That's why, if you and I are dancing near each other, we may find ourselves passing through each other like two ghosts. If we stop dancing and one of us walks into the other, we collide. There isn't, I'm sorry to say, any way to find out what angle the animation is putting you without having access to the animation code itself (which we don't have unless we created it and can look at the local copy of the .bvh or .anim file we've uploaded). 1 Link to post Share on other sites
Rolig Loon 27,288 Posted April 2, 2013 Share Posted April 2, 2013 Innula is correct. As far as the servers are concerned, we never lie down. We are always standing, perfectly vertical, unless we happen to be linked to something else that has been rotated. 1 Link to post Share on other sites
Nescolet 5 Posted April 2, 2013 Share Posted April 2, 2013 Thank you all for your help, specially to Innula for the clear explanation on what the server knows about animations. Cheers! Link to post Share on other sites
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now