Jump to content

LSL_Help_Post_11


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

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

Recommended Posts

The fourth parameter you've entered, <0,0,0>, should be a rotation. What you've put there has three components, so it's seen as a vector. In LSL rotations are quaternions and have four components. But you really don't need to worry about those. Just use the built-in constant ZERO_ROTATION.

If you do need to use something other than a zero rotation use llEuler2Rot (vector) if you're comfortable with radians, or llEuler2Rot (vector * DEG_TO_RAD) if you'd prefer to specify the x, y and z rotation components in degrees.

Also, the third parameter, for which you've used llGetCameraPos(), is a velocity that's applied to the rezzed object (useful for bullets and other projectiles). If the object you're rezzing is physical the results could be quite spectacular and unpredictable, though if it isn't physical the parameter won't have any effect.

Edited by KT Kingsley
Link to comment
Share on other sites

First you need to get PERMISSION_TAKE_CONTROLS using llRequestPermissions. Then when that permission is granted, in the run_time_permissions event you need to use llTakeControls for CONTROL_ML_LBUTTON.

Once you've done that the control event will be triggered whenever the left mouse button is pressed or released while you're in mouselook. The level parameter (as it's called in the wiki - you might be more comfortable calling it something like "pressed") has a bit corresponding to the value of CONTROL_ML_LBUTTON set when the mouse button is pressed and cleared when it's released. You test it by using bitwise &:

if (level & CONTROL_ML_LBUTTON) // the button is pressed
else // the button is not pressed

The edge (perhaps more comfortably called "changed") parameter tells you if the state of the button has changed since the last time the control event was triggered. You test it in the same way as the level parameter.

So with those two parameters you can figure out if the button has just been pressed, or is still pressed, or has just been released, or is still not pressed.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1266 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...