Jump to content

Mouse look actions


Moni Telling
 Share

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

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

Recommended Posts

32 minutes ago, animats said:

It's not that hard, but there's a lot of boilerplate code needed to get mouselook touches reliably. Here's some code of mine which does that. This is a little wearable object which lets you click on things in mouselook and read their pathfinding properties. You can adapt that to do other things. Enjoy.

thank you! I'm looking now!

Link to comment
Share on other sites

11 minutes ago, Moni Telling said:

how do I get  it to work like a bowling ball like a power up after holding it for like 5 seconds it speed is 100.

Oh, you're scripting the touched object, not the avatar doing the touching. Completely different.  Read up on touch events.

Here's a cute approach. Make the object a physical sphere. Detect touches with touch_start and touch_end. At touch_start, use llDetectedTouchNormal to get the direction to move. At touch_end, get the time difference since the touch_start, and use that to compute your "power". The longer you hold down the mouse, the more power.  Multiply that by the inverse of the touch normal and apply it as an impulse with llApplyImpulse. The object will go rolling off opposite the touch point. If you want the object to stay on the ground, zero out the Z term of the vector before applying the impulse. Have fun bowling!

Link to comment
Share on other sites

12 hours ago, Moni Telling said:

how do I get  it to work like a bowling ball like a power up after holding it for like 5 seconds it speed is 100

This sounds like it would be similar to a gun script - in that the avatar would create a projectile (bowling ball in this case) and "shoot" it forward relative to the direction they are currently facing in mouselook. The extra catch here is that you'd like to alter the strength of the throw based on how long the user holds the button before firing. Does this sound accurate?

Assuming this is what you're trying to do, then you would need to study the control event, as this that would be what is responding to the user's button presses. The control event triggers whenever a button is pressed, whenever a button is released, and also continuously while a button as being held down. This can be used to suit your needs quite easily.

Generally speaking, you would configure your control event to increment a "power" variable while the user holds down the desired button and then, when the user releases the button, you would "fire" the projectile using the current value of the power variable. You'd also want to reset the power variable to zero when the projectile is fired, to get ready for the next shot.

Visually speaking, I imagine the avatar would wear a bowling ball as an attachment in their hand. This would effectively be the "gun". When the player "throws" the ball, the worn attachment turns itself invisible and rezzes the projectile bowling ball simultaneously to simulate the effect of them throwing it out of their hands.

 

Edited by Fenix Eldritch
Link to comment
Share on other sites

3 hours ago, Fenix Eldritch said:

This sounds like it would be similar to a gun script - in that the avatar would create a projectile (bowling ball in this case) and "shoot" it forward relative to the direction they are currently facing in mouselook. The extra catch here is that you'd like to alter the strength of the throw based on how long the user holds the button before firing. Does this sound accurate?

Assuming this is what you're trying to do, then you would need to study the control event...

That's what it turned out to be. The object is a football that gets "kicked". I was thinking the original poster wanted to push around an object that's already in world, as in a pool table game.

Link to comment
Share on other sites

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