Jump to content

Making a boat move sideways


DonnaMitchell
 Share

You are about to reply to a thread that has been inactive for 1952 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello all,

I am in the process of scripting a boat. I've gotten everything sorted so far except for how to make the boat move sideways. I've seen some boats do this with the SHIFT+LEFT/RIGHT and the script I have that came with a boat that does this, I can't seem to find where in the script that allows this. Both this script and my script seem to have the same lines of script for moving the boat.

Any help would be appreciated.

Thanks. :)

Link to comment
Share on other sites

40 minutes ago, DonnaMitchell said:

that's where im stuck...im just not sure what the definitions are...

 

control(key id, integer levels, integer edges)
   

You might want to read up on the wiki page on what kind of constants you can use in your key checks. 

http://wiki.secondlife.com/wiki/Control

Edited by Wulfie Reanimator
  • Like 1
Link to comment
Share on other sites

The keys are often defined using constants. For example, CONTROL_LEFT and CONTROL_RIGHT are the constants used when referring to the key press SHIFT+LEFT and SHIFT+RIGHT respectively. You can find a list of all the control constants on the wiki. Here's the control event page.

Generally speaking, when a control event is processed, it starts out with those three variables "id", "levels" and "edges" being populated with information as outlined in the wiki. Think of it as a snapshot taken the instant any key is pressed. Id is the key of the avatar currently controlling the script (read: who has given permission for the script to act on their inputs). Levels and Edges are integer bitfields which together can be used to determine the exact status of all keys at once (integers are 32-bits long, and each bit is being used as a sort of on/off flag assigned for each key). This status can tell you if the keys have just started to be pressed, are currently being held down, have just been released, or haven't been touched at all. By performing logical operations on these two variables in conjunction with one of the control constants, you can suss out meaningful status for a given key.

  • Like 1
Link to comment
Share on other sites

ok, looks like I am getting somewhere...apparently the CONTROL_LEFT and CONTROL_ROT_LEFT were lumped together as was the RIGHT. I separated them now and have this....

if (edges & levels & CONTROL_LEFT) 
        {
            
            
        } else if (edges & ~levels & CONTROL_RIGHT) 
        {
            
            
        } else 
        {
            
    }

  • Like 3
Link to comment
Share on other sites

10 minutes ago, DonnaMitchell said:

apparently the CONTROL_LEFT and CONTROL_ROT_LEFT were lumped together as was the RIGHT.

 What you are missing yet is the stuff that goes between the { curly brackets } after your if statements.  By studying the similar blocks of code that define what happens with CONTROL_FORWARD and CONTROL_BACK, you ought to be able to figure out similar language for moving left or right. 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1952 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...