CharlieFinlayson Humbridge
Registered User
Join date: 17 Nov 2009
Posts: 3
|
11-22-2009 14:56
//Causes Object to look at nearest Avatar. default { state_entry() { llSensorRepeat("", "", AGENT, 20.0, PI, 0.2); } sensor(integer total_number) { llRotLookAt(llDetectedPos(0) + <0.0, 0.0, 1.0>, 3.0, 1.0); } }
This just won't compile, but it will when llRotLookAt is changed to llLookAt. Why!?
"Function call mismatches type or number of arguements" is the message I get.
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
11-22-2009 15:10
1. argument for the llRotLookAt is a rotation 1. argument for the llLookAt is a vector
llRotLookAt won't compile if the 1. argument is a vector
Please note: llLookAt will point the UP(Z-vector) at the point and llRotLookAt will point the FWD(X-vector) in the given direction.
_____________________
From Studio Dora
|
CharlieFinlayson Humbridge
Registered User
Join date: 17 Nov 2009
Posts: 3
|
11-22-2009 15:39
I know that, and I figured out it was a rotation instead of a vector. So I tried the llLookAt, and changed the offset to higher, but it still behaves really mysteriously, doesn't seem to look the at my avatar the way it should. I tried llRotLookAt, using what I think was a correct llEuler2Rot conversion, and it just rotated totally randomly depending on where I was standing. I just want my virtual pet to look at me on the X or Y axis while being stuck to the ground. Why is that so hard? 
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
11-22-2009 16:16
Since it seems you changed your code from the initial post, why not post the revised code that compiles but doesn't work?
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
11-22-2009 17:07
Someone in this thread had a similar problem -- might be of interest /54/5b/350751/1.html
|
Kayaker Magic
low carbonated footprint
Join date: 11 Sep 2008
Posts: 109
|
11-22-2009 17:17
Heres a version that works (yes, I tested it!) //Causes Object to look at nearest Avatar. default { state_entry() { llSensorRepeat("", "", AGENT, 20.0, PI, 1); }
sensor(integer total_number) { vector fwd=llVecNorm(llDetectedPos(0)+<0,0,1>-llGetPos()); //vector pointing above avatar vector lft=<0,0,1>%fwd; //cross product is in the XY plane rotation rot=llAxes2Rot(fwd,lft,fwd%lft); //convert to rotation llRotLookAt(rot, 3.0, 1.0); } } The problem is you need a rotation, but what you have is only a location. The vector from the prim to the avatar (plus 1 meter to kind of point at the head) can be converted to a rotation. Here I chose a LFT vector that is perpendicular to the direction vector, and parallel to the XY plane (perpendicular to <0,0,1>. That keeps the prim oriented right side up with no side-to side tilting. Now there is enough information for llAxes2Rot to rotate the prim. Keeping it on the ground is a different problem, this rotation trick will work from above the ground. (But not DIRECTLY above where the cross product will fail!)
|