Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Geometry or trig question and key detection.

Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
04-24-2006 04:00
First, using llSetPos() a prim can be moved along the xyx coordinates, but if the prim has a different rotational orientation is still moves along the global coordinates. Where can I find the calculations to continue to move in the direction of the prims coordinates?

Second, I know that using control functions, the arrow and pg up/down can be detected. Are there any other keys or combination of keys that can be detected by a script?
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
04-24-2006 04:07
vector move;
llSetPos(move * llGetRot());

Should do the first.

I assume you know the strafing and various mouseclicks too. The only other way I know of is listen events, and I guess gesture triggers.
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Thanks
04-24-2006 04:21
I will try out the move suggestions. I will have to look up "strafing", and look closer at mouse input.

Mod
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
04-24-2006 05:28
You might need llGetPos() + move * llGetRot() actually, the first post was pre-coffee!

The strafing is shift + left/right arrows. It's to anyone except an FPS gamer, a sidestep, but the name stuck from FPS games I guess.
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Ms. Pasteur
04-24-2006 07:02
Thank you so much. The move is working perfectly. I switched the actions for (CONTROL_ROT_RIGHT) with those for (CONTROL_RIGHT) and same for left. Seemed more logical to me to have the arrows move in xyz direction and the shift to be used for turns.

Now I an looking at script flow. What I would like is to replace the whole series of "if this control then that action" to catching whichever control is input and sending flow to a function than handles all. Would have the same results but would be "pretter" to look at lol.

Mod
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
Ms. Faulkner
04-24-2006 11:43
To be pedantic that's Dr. Pasteur!

I don't use controls() that regularly, but I must admit I do it the if else way... maybe it just reflects how I think, but following a chain of if else statements makes sense to me when debugging, pretty code can be truly wonderful as long as I understand it later.

On a different note, I thoroughly enjoyed the blimp ride around Caledon, although getting off the blimp and falling into the river at the end was an unexpected surprise!
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
04-24-2006 11:47
Well, one can't provide free parachutes, you know!

I use control() a fair amount, but I find that migrating the whole thing to a function doesn't help a lot, considering that you're only likely to have one control event in the whole script. Perhaps if you had different states, each with a control event, or you had a lot of duplicated code with just a slight difference when testing for each control. I wouldn't worry too much about it.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-24-2006 15:05
From: Ordinal Malaprop
Well, one can't provide free parachutes, you know!
Cubey Terra does! :)