Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dash script

mrbarcode Aeon
Registered User
Join date: 4 Aug 2008
Posts: 11
12-16-2008 10:02
I've created a basic dash script that allows me to travel very fast either forward or reverse. However I want to be able to use it in mouselook and go the direction I'm looking. Any tips?
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
12-16-2008 11:02
From: mrbarcode Aeon
I've created a basic dash script that allows me to travel very fast either forward or reverse. However I want to be able to use it in mouselook and go the direction I'm looking. Any tips?

I believe your avatar is turned so that the direction you're looking is ALWAYS, "straight forward;" at least in a horizontal sense. In any case 'llRot2Fwd(llGetRot())' in an attachment gives the direction you are looking in mouselook.
mrbarcode Aeon
Registered User
Join date: 4 Aug 2008
Posts: 11
12-16-2008 11:23
Hmmm still having issues
CODE

if ( ((keyHeld & CONTROL_FWD) == CONTROL_FWD)
&&((keyMod & CONTROL_BACK) == CONTROL_BACK) )
{
vector face = llRot2Fwd(llGetRot());
warpPos(face*warp);
llPlaySound(llGetInventoryName(INVENTORY_SOUND,0), 1.0);
}


so when someone presses the key combo it should dash in the facing direction. it only goes north or south
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
12-16-2008 16:33
Oh. I see. This isn't really a "dash" in the traditional attachment/physics sense. It is a non-physical vehicle. In that case, logic that goes something like this should work:

CODE

vector getSitterFacing(key sitter)
{
list details = llGetObjectDetails(sitter, [ OBJECT_ROT ]);
if (llGetListLength(details) <= 0)
{
// Agent not in sim?
return ZERO_ROTATION;
}

rotation sitterRot = llList2Rotation(details, 0);
return llRot2Fwd(sitterRot);
}
mrbarcode Aeon
Registered User
Join date: 4 Aug 2008
Posts: 11
12-16-2008 21:19
From: Hewee Zetkin
Oh. I see. This isn't really a "dash" in the traditional attachment/physics sense. It is a non-physical vehicle. In that case, logic that goes something like this should work:

CODE

vector getSitterFacing(key sitter)
{
list details = llGetObjectDetails(sitter, [ OBJECT_ROT ]);
if (llGetListLength(details) <= 0)
{
// Agent not in sim?
return ZERO_ROTATION;
}

rotation sitterRot = llList2Rotation(details, 0);
return llRot2Fwd(sitterRot);
}

If by vehicle you mean hud then yes.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
12-17-2008 09:46
From: mrbarcode Aeon
If by vehicle you mean hud then yes.


Hmm. Well, if by "warpPos" you are invoking the usual non-physical movement function that commonly goes by that name, it will not work from an attachment of any kind, including HUD attachments (then again, the usual "warpPos" tries to go to a fixed position not an offset from the current position; I'm really not sure what yours is trying to do). Given that and your statement that it always went north/south, it seemed reasonable to assume llGetRot() is being called from a non-attached object, so it wouldn't reflect the direction the avatar is facing.

I think we're not going to be able to help much here unless we have more code or more specific info/questions.