|
Keno Pontoppidan
Registered User
Join date: 20 Oct 2005
Posts: 75
|
01-07-2007 04:23
Well I have been working on a large cannon and I tryed to script it where it could work with a control panel (Rotate Up ,Rotate Down, Rotate Left, Rotate Down, Reset and Fire). Now with the barrels which have to rotate up/down and left/right when there pointing forward I have no problems and if I rotate them left/right while there level I have no problems but if I have them pointing up and I try to rotate them it gets... funky.. Here are some screenshots to give a better understanding. http://i42.photobucket.com/albums/e338/kenosos/Snapshot_001.jpghttp://i42.photobucket.com/albums/e338/kenosos/Snapshot_002.jpghttp://i42.photobucket.com/albums/e338/kenosos/Snapshot_003.jpgAlso heres the script. integer rot; integer rot2; default { state_entry() { llListen(120684,"","",""); } listen(integer channel, string name, key id, string message) { if(message == "left") { rot += 10; vector eul = <rot2,0,rot>; eul *= DEG_TO_RAD; rotation quat = llEuler2Rot(eul); llSetRot(quat); } if(message == "right") { rot -= 10; vector eul = <rot2,0,rot>; eul *= DEG_TO_RAD; rotation quat = llEuler2Rot(eul); llSetRot(quat); } if(message == "up") { rot2 -= 10; vector eul = <rot2,0,rot>; eul *= DEG_TO_RAD; rotation quat = llEuler2Rot(eul); llSetRot(quat); } if(message == "down") { rot2 += 10; vector eul = <rot2,0,rot>; eul *= DEG_TO_RAD; rotation quat = llEuler2Rot(eul); llSetRot(quat); } if(message == "reset") { rot = 0; rot2 = 0; vector eul = <rot2,0,rot>; eul *= DEG_TO_RAD; rotation quat = llEuler2Rot(eul); llSetRot(quat); } if(message == "fire") { llMessageLinked(LINK_SET,0,"fire",""); } } }
|
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
01-07-2007 05:03
Try using this instead of llEuler2Rot. I think your issue is coming from the order of the rotation. This little function should reverse the order to which it is combined. rotation Euler2Rot(vector in) { rotation out = llEuler2Rot(<in.z, in.y, in.x>); return <out.z, out.y, out.x, out.s>; }
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
|
Keno Pontoppidan
Registered User
Join date: 20 Oct 2005
Posts: 75
|
01-07-2007 05:10
Didnt work  Still doing the same thing.
|
|
Tripod Dangle
Registered User
Join date: 6 Jun 2005
Posts: 12
|
01-07-2007 06:52
This might work... rotation Euler2Rot(vector in) { rotation out = llEuler2Rot(<in.z, in.y, in.x>); out = out*llGetRot(); return <out.z, out.y, out.x, out.s>; }
|
|
Keno Pontoppidan
Registered User
Join date: 20 Oct 2005
Posts: 75
|
01-07-2007 07:00
That seemed to make it worse.. Anyone who wants to help can IM in game and Ill tp you to show you what its doing.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-07-2007 07:30
It looks as if You have probably linked to the right hand face of the root prim not the front. But having spoken too you and seen the prob up close I know I'm wrong.
|
|
Tripod Dangle
Registered User
Join date: 6 Jun 2005
Posts: 12
|
01-07-2007 15:52
I think the problem is in the rot and rot2 both being used..Should just need one of those or like this: if(message == "up") { vector eul = <-10,0,0>; eul *= DEG_TO_RAD; rotation quat = llEuler2Rot(eul); quat = quat*llGetRot(); llSetRot(quat); } if(message == "down") { vector eul = <10,0,0>; eul *= DEG_TO_RAD; rotation quat = llEuler2Rot(eul); quat = quat*llGetRot(); llSetRot(quat); }
Hopefully that'll work
|