Sean Martin
Yesnomaybe.
Join date: 13 Sep 2005
Posts: 584
|
11-12-2005 19:15
This is embarassing but, I've struggled with a simple script where an object gets flipped around in three ways just by clicking on it. And then returns to its origonal position and keeps repeating these positions if the person keeps clicking. There is a basic "default" position, then clicking once flips the object 90 degrees sideways, then a second click will flip it upside down. One more click makes the object go back to its default right-side up position. And it starts all over. I can't get this to work for anything even after spending hours and hours in the forums and library. Someone already helped me with the EUL stuff with rotation on Live Help so I didn't want to bother them again. But now I just can't seem to get down the basic logic. Everything keeps giving me syntax errors so I know its the fact that I'm not used to the way things are used in LSL. If someone could help I would be most greatful. 
|
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
11-13-2005 00:13
Post what you have scripted so far and I'll see if I can't shed some light on what's going wrong.
|
Dyne Talamasca
Noneuclidean Love Polygon
Join date: 9 Oct 2005
Posts: 436
|
11-13-2005 02:47
Well, each position is basically a state of the object. Something along these lines should work: default { state_entry() { // Make our quaternion for rightside up // YourRotation = Magic voodoo the other person told you in order to get the Quaternion from the Euler
// Use it llSetRot(YourRotation);
// Now we start waiting for touches state WaitForTouchOne; } }
state WaitForTouchOne { // Just sit here and wait until somebody touches us
touch_start(integer numtouching) // This is not run until we have been touched... { // Hey, somebody touched me!
// Make our quaternion for sideways here // YourRotation = More Hocus Pocus
// Use it llSetRot(YourRotation);
// We've rotated. Go to next state and twiddle thumbs. state WaitForTouchTwo; } }
state WaitForTouchTwo { // Same logic as above, essentially
touch_start(integer numtouching) { // Stop poking me!
// Make our quaternion for upside down // YourRotation = Avra Cadavra
// Use it llSetRot(YourRotation);
// Go to next state, young man. state WaitForTouchThree; } }
state WaitForTouchThree { // OK, I'm fed up. If I get touched again, I'm starting over.
touch_start(integer numtouching) { // !!!
// Fine, then. Let's be rightside up, see how you like that! // YourRotation = Shazaam!
// Use it llSetRot(YourRotation);
// 20 Goto 10 state WaitForTouchOne; } }
Of course, there are other ways to do it.
|
Sean Martin
Yesnomaybe.
Join date: 13 Sep 2005
Posts: 584
|
Thanks!
11-13-2005 19:41
Hey this works great. Thanks Dyne!  The only problem I have now is I can't move the object around by grabing it. Even with the grab state set to true. Is that just how SL works? If there is a script running in an object I can't move it? If so I guess I'll have to make vendor arrow keys of some sort to move it around. This is for a part of a game wher the players can move cards around and flip and rotate.. etc. But its easier if they could just grab the card instead of using edit mode to position them. Or use prim heavy buttons on each game piece. That would be crazy. It would be nice to just grab it anyways. And preferably with only the owner allowed to grab it. Dunno how that would work but I seen it before I thought. The rotation is working. Thanks 
|
Dyne Talamasca
Noneuclidean Love Polygon
Join date: 9 Oct 2005
Posts: 436
|
11-13-2005 20:40
Hm. It's not locked, is it?
I'm not sure if that's normal or not, as I've never tried to make something draggable intentionally. I'd think not, given that the touch stuff in the wiki mentions setting grab state to prevent that, but it could have been changed intentionally or accidentally.
|
Sean Martin
Yesnomaybe.
Join date: 13 Sep 2005
Posts: 584
|
..
11-13-2005 21:23
Yeah its not locked. And I can't even make a fresh object grabable either. I have grabing happen when I don't want it to. But when I DO want a drag ability on an object.. it doesn't let me. LOL I think someone hates me :\
|