|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
04-27-2006 00:00
Greetings,
I am having a problem with an object that has a toggleable rotation (click on it, it rotates a certain amount, click on it again, it rotates back to its "home" position). When no avatar is sitting on it, it works perfectly. However, when an avatar is sitting on it, it sometimes works OK, but then sometimes it will cause the objet to move a certain distance.
I assume it it due to the avatar becoming "part" of the object (like an attachment) and thus changing its center of rotation, but I am unsure of how to detect and correct this condition, since it seems to be only happening part of the time. I have tried to use various combinations of llSetLocalRot / llGetLocalRot and the world coordinate versions llGetRot/llSetRot.
Any suggestions?
|
|
Jigsaw Partridge
A man of parts
Join date: 3 Apr 2005
Posts: 69
|
04-27-2006 00:27
Hmmm, a seated (as opposed to attached) avatar doesn't usually affect object shift/rotation in that way - the values you get back from llGetPos()/llGetRot() should be the same whether there is a seated avatar or not. There must be something else going on.
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
04-27-2006 00:58
This is the same problem as Dawn Moseley was describing in the other post. I am helping her with the object in question. Basically, I apply a converted Euler rotation to the object.. something like this: state = !state; if (state) llSetRot(llEuler2Rot(myrotation)*llGetRot()); else llSetRot(llEuler2Rot(-myrotation)*llGetRot());
I realize now that the small errors will cause drift, and I can see how to correct for it. However, the rotation error is sometimes not small, on the order of half a meter. It looks like the object is rotating around a center somewhere around the center of the object and the avatar together. What is really strange is that I built a simple tester, and I can't repeat it with it when I sit on and click the object to rotate it back and forth. We noticed that if the person sitting on it clicks it, it doesn't mess up. However if someone else clicks the object, it will sometimes move a significant distance, but other times will not. Anyway, we're still investigating the behavior, trying to see what causes it. More info as we have it, and if anyone has any ideas, please let us know. 
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
04-27-2006 22:39
Update:
Did a bit more experimentation this eve with a modifed version of the script that saves the "start" position and rotation, and restores both every other toggle action. Solves the "drift" problem, but we still have an occasional bit of movement (0.25-0.5m at times).
From our tests, it appears that, if the avatar collides with another object or avatar during the rotation, it sometimes causes the rotation to also move the object. Not sure why this is, but we've been able to replicate it fairly consistently. Anyone know why this might be happening?
|