Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Working on a ride, need some help

Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-21-2005 11:03
My partner asked me to look into making a Teacup style ride for her land. I've been doing a bunch of reading on LSL and scouring the forums lately to get me up to speed on scripting and thought I might be able to do it.

So far, I've been able to make a base rotate using llTargetOmega and even have 3 cups linked to it rotating as well.

My problem seems to be that I can't have a person sit in a cup and have him rotate with the cup instead of just the base. Either I'm making some logistical error or maybe it can't be done the way I was working.

I don't have much code beyond the llTargetOmega calls and having the ride activate via touch_start. Adding sit targets to the cups didn't seem to help much either.

I'm thinking this probably can't be done or I need to investigate using physics instead. Can any of you script-foo master help me out? Can it be done?

Thanks,
D
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-21-2005 15:25
Interesting problem. This is one I've not heard before.

First off, have you removed the sit target from the master object? (that is, the base itself) You can do this by adding the following code to the base:

CODE
llSitTarget(ZERO_VECTOR,ZERO_ROTATION);


That seems to be the problem, but if it isn't, speak with Davy Flytrap. I helped him with this same issue in-world a month? ago, so he might be able to give you the solution I used. :)
_____________________
---
cinda Hoodoo
my 2cents worth
Join date: 30 Dec 2004
Posts: 951
Ferris Wheel Maker!
04-21-2005 15:32
From: Damian Zander
My partner asked me to look into making a Teacup style ride for her land. I've been doing a bunch of reading on LSL and scouring the forums lately to get me up to speed on scripting and thought I might be able to do it.

So far, I've been able to make a base rotate using llTargetOmega and even have 3 cups linked to it rotating as well.

My problem seems to be that I can't have a person sit in a cup and have him rotate with the cup instead of just the base. Either I'm making some logistical error or maybe it can't be done the way I was working.

I don't have much code beyond the llTargetOmega calls and having the ride activate via touch_start. Adding sit targets to the cups didn't seem to help much either.

I'm thinking this probably can't be done or I need to investigate using physics instead. Can any of you script-foo master help me out? Can it be done?

Thanks,
D


This is pretty hilarious.. my partner and i are trying to make a ferris wheel, but need the gondola not to revolve around the base that we have on a rotation!!!

LOL we shoud get together and make an amusement park! BTW does everyone love carnival food?? mmmmmmmm...thanks yall for the help on the teacup..that just mite work for us too!
Torment Thorn
Visit Never Never Land
Join date: 22 Apr 2004
Posts: 57
04-21-2005 15:50
There is someone working on this. (I'm the partner mentioned above BTW) Please IM us in world to collaborate. I'd love to buy the ferris wheel from you or at least a version of it or a commissioned one if possible. Please come to Never Never Land in Rua to talk with us about this and more collaboration. :)
_____________________
Something Wicked This way comes...
Wicked, Inc. Design House and Entertainment Events
Weber (78,204)
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-21-2005 17:42
From: Jeffrey Gomez
Interesting problem. This is one I've not heard before.

First off, have you removed the sit target from the master object? (that is, the base itself) You can do this by adding the following code to the base:

CODE
llSitTarget(ZERO_VECTOR,ZERO_ROTATION);


That seems to be the problem, but if it isn't, speak with Davy Flytrap. I helped him with this same issue in-world a month? ago, so he might be able to give you the solution I used. :)


Jeff,

Thanks for the tip. I've added this to the base script. I think I'm doing something stupid though, because I can't seem to get the base and cups working reliably to continue testing the sit target.

Now that I can log in, let me paste the code I've been using.

The Base has this in it:
CODE
integer spin = 0;
default {
state_entry() {
llSitTarget(ZERO_VECTOR,ZERO_ROTATION);
}
touch_start (integer num_detected) {
if (!spin) {
llTargetOmega(<0,0,1>,PI,0.5);
llMessageLinked(LINK_SET,1, "", "");
spin = 1;
} else {
llTargetOmega(<0,0,1>,PI,0.0);
llMessageLinked(LINK_SET,0, "", "");
spin = 0;
}
}

}


And each cup has this in it:

CODE

default
{
state_entry()
{
}
link_message(integer sender_num, integer num, string str, key id) {
if (num == 0) {
llTargetOmega(<0,0,1>,TWO_PI,0);
} else if ( num == 1 ) {
llTargetOmega(<0,0,1> * llGetLocalRot(),TWO_PI,2.0);
}
}
}


This is as far as I've gotten. Every once in a while I can actually get it to work (without sitting on it).

Any suggestions?
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-21-2005 17:51
Yep. I don't see a sit target in the code for each cup. Have you tried that yet?
_____________________
---
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-21-2005 17:53
From: Jeffrey Gomez
Yep. I don't see a sit target in the code for each cup. Have you tried that yet?


Not yet as I was attempting to get the base & cups spinning properly again. They've been acting quirky since I logged on. Sometimes just the base turns, sometimes just the cups. Odd. Was going to add sit targets after I did that.
Stylez Gomez
Union Micro
Join date: 4 Jun 2004
Posts: 146
04-21-2005 17:58
Hmm... is client-side rotations really ideal for something such as a ride? That could be why sometimes parts of the ride don't rotate. I had this problem with a ceiling fan. I had to slightly change the colour of it when it turned on and off to force the client to update the rotations.
_____________________
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-21-2005 18:02
From: Stylez Gomez
Hmm... is client-side rotations really ideal for something such as a ride? That could be why sometimes parts of the ride don't rotate. I had this problem with a ceiling fan. I had to slightly change the colour of it when it turned on and off to force the client to update the rotations.


Yeah, I've seen it mentioned in another thread to use

CODE
llSetAlpha(llGetAlpha(0),0);
in concert with llTargetOmega. I've tried that, with mixed results.

BTW Jeffrey, I added sit targets to the cups, still attempting to get the whole thing rotating correctly.
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-21-2005 18:11
Okay, after some monkeying around, I got the whole thing rotating again. Added sit targets to the cups.

Now, if I sit in a cup, it the cup rotates, the base rotates, but I don't rotate with the cup, just the base.
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-22-2005 11:36
Pushing this back up to the top if anyone has any more suggestions for me. Didn't see Davy on last night to ask him.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-22-2005 12:37
Interesting. I find it odd that sit is having this sort of problem.

If all else fails, keep llTargetOmega in the cups, and add something like this to the base:

CODE

default
{
state_entry()
{
llSetTimerEvent(0.3);
}
timer()
{
llRotLookAt(llEuler2Rot(<0,0,5> * PI / 180) * llGetRot(),0.3,0.3);
}
}


.. which will physically rotate the base around. See, llTargetOmega is a client-side effect - no server calls are made beyond starting it up. You might also bug report the fact that nesting them with a sit has problems... it sounds like a glitch to me.

That's essentially what I did for Davy's ride.
_____________________
---
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-22-2005 13:29
From: Jeffrey Gomez
Interesting. I find it odd that sit is having this sort of problem.

If all else fails, keep llTargetOmega in the cups, and add something like this to the base:

CODE

default
{
state_entry()
{
llSetTimerEvent(0.3);
}
timer()
{
llRotLookAt(llEuler2Rot(<0,0,5> * PI / 180) * llGetRot(),0.3,0.3);
}
}


.. which will physically rotate the base around. See, llTargetOmega is a client-side effect - no server calls are made beyond starting it up. You might also bug report the fact that nesting them with a sit has problems... it sounds like a glitch to me.

That's essentially what I did for Davy's ride.


Yeah, thought it a bit strange. I know llTargetOmega's client-side, was trying to get away with not having to employ physics if possible. I'll try that code later when I get into SL.

Yeah, I see no logical reason why nesting the sit/targetomega wouldn't work, but I'm just a newbie at this. I'll see if I can report it.
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-22-2005 17:00
From: Damian Zander
Yeah, thought it a bit strange. I know llTargetOmega's client-side, was trying to get away with not having to employ physics if possible. I'll try that code later when I get into SL.

Yeah, I see no logical reason why nesting the sit/targetomega wouldn't work, but I'm just a newbie at this. I'll see if I can report it.


Okay just tried the code that you gave me Jeffrey. Does the same thing as just the llTargetOmega in the base. The base rotates, the cups rotate, me sitting in cup doesn't.

I'm in game for a while if you'd like to come see. I'm thinking this just isn't doable at the moment.
Reitsuki Kojima
Witchhunter
Join date: 27 Jan 2004
Posts: 5,328
04-22-2005 17:10
Target omega rotates whole-objects only. It's pretty much useless for anything that involves avatars sitting on it, because of that, and because it's a client-side effect only. Any updates screw it up.
_____________________
I am myself indifferent honest; but yet I could accuse me of such things that it were better my mother had not borne me: I am very proud, revengeful, ambitious, with more offenses at my beck than I have thoughts to put them in, imagination to give them shape, or time to act them in. What should such fellows as I do crawling between earth and heaven? We are arrant knaves, all; believe none of us.
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-22-2005 18:30
From: Reitsuki Kojima
Target omega rotates whole-objects only. It's pretty much useless for anything that involves avatars sitting on it, because of that, and because it's a client-side effect only. Any updates screw it up.


That's nice and so I had already figured out. Is there a way to do this otherwise?
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-22-2005 19:01
Yep. Nest the physical "trick" I used. Just make sure there's an "off" switch. It lags. :o
_____________________
---
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-22-2005 19:34
From: Jeffrey Gomez
Yep. Nest the physical "trick" I used. Just make sure there's an "off" switch. It lags. :o


Yeah, that's what I figured. Do I need to make the objects themselves physical to get this to work as well?
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-22-2005 19:46
Physics does change the behavior slightly, but llRotLookAt/llLookAt will work without physics.
_____________________
---
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-22-2005 19:51
From: Jeffrey Gomez
Physics does change the behavior slightly, but llRotLookAt/llLookAt will work without physics.


K, good. Yeah I put it in a touch start event like before. Here's the code I have now.

Base:
CODE
integer spin = 0;
default {
state_entry() {
llSitTarget(ZERO_VECTOR,ZERO_ROTATION);
}
touch_start (integer num_detected) {
if (!spin) {
llMessageLinked(LINK_SET,1, "", "");
llSetTimerEvent(0.3);
spin = 1;
} else {
llMessageLinked(LINK_SET,0, "", "");
llSetTimerEvent(0);
spin = 0;
}
}

timer() {
llRotLookAt(llEuler2Rot(<0,0,5> * PI / 180) * llGetRot(),2,2);
}
}


Teacup:
CODE

default {
state_entry() {
llSitTarget(<0, 0, 0.1>, ZERO_ROTATION);
}
link_message(integer sender_num, integer num, string str, key id) {
if (num == 0) {
llSetTimerEvent(0);

} else if ( num == 1 ) {
llSetTimerEvent(0.3);
}
}
timer() {
llRotLookAt(llEuler2Rot(<0,0,5> * PI / 180) * llGetLocalRot(),5,5);
}
}


Cups aren't spinning now though, tried with llGetRot and llGetLocalRot. Base spins.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-22-2005 20:11
Oop. Forgot the conversion for child objects. Try replacing (in the cups) llRotLookAt with llSetLocalRot and llGetRot with llGetLocalRot. Some other changes need apply here, but that's the jist of it.

That's what I get for cutting sleep out of my schedule this week. :rolleyes:

That won't be as smooth, however. If you want to use llRotLookAt, the conversion equation for llSetLocalRot is around here somewhere... :)
_____________________
---
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
04-22-2005 20:19
From: Jeffrey Gomez
Oop. Forgot the conversion for child objects. Try replacing (in the cups) llRotLookAt with llSetLocalRot and llGetRot with llGetLocalRot. Some other changes need apply here, but that's the jist of it.

That's what I get for cutting sleep out of my schedule this week. :rolleyes:

That won't be as smooth, however. If you want to use llRotLookAt, the conversion equation for llSetLocalRot is around here somewhere... :)


Ah, gotcha. Figured it was something like that. So now the cups and base are rotating, I still don't turn with the cup when sitting in it though.
Damian Zander
Wicked, Inc.
Join date: 21 May 2004
Posts: 19
05-10-2005 19:43
From: Damian Zander
Ah, gotcha. Figured it was something like that. So now the cups and base are rotating, I still don't turn with the cup when sitting in it though.



So yeah, I've played around a bit with it and it's still a no go. I can get it to consistently start up and rotate the base and cups, and have set the sit targets in the cups, but oddly it doesn't rotate me around in the cup when I sit in it. I rotate around as the base rotates only. So I'm still stumped. Oh well, I'll take another stab at it one day. If anyone has any ideas, lemme know :)