Jump to content

Grid-based movement in LSL


Galyo
 Share

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

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

Recommended Posts

I'm sorry if this question has been answered before; I've tried searching for the topic, but since the word "grid" has a double meaning it's really difficult to get accurate results regarding this.

My question: I was wondering if somebody has tried to create a system that handles grid-based movement using LSL in Second Life. I'm of course already pondering about how to go about creating one myself, but if someone has already done a lot of the leg work that would save me a lot of hassle. :P If anything, some general tips and advice would be nice as well!

When I say "grid-based movement" think of checkers, or chess; a system that allows you to move your avatar along a fixed grid on the ground like a board game.

Thank you!

Link to comment
Share on other sites

Unless you mean movement by teleport, there's no way to move an avatar directly with LSL. It's easy to move something that an avatar is linked to, however. The "something" can be visible like a vehicle or an elevator, or it could be a transparent object that the avatar is linked to temporarily. The avatar can be animated any way you like, so can be seated (as in a car or an airplane) or can have a standing or walking anim (so that it's not apparent that the avatar is linked to something that is moving). The moving object can be under control of a script that moves it along a pre-planned trajectory (like a train or a pod car) or can be under the total or partial control of the rider ( as in a private car).  Systems like these have been used for everything from region-wide transportation networks to choreographed dance troupes.  If you're interested in systems that move avatars along pre-planned paths that cover several regions, consider the trolley system in Bay City as an example.  

Link to comment
Share on other sites

3 hours ago, Rolig Loon said:

Unless you mean movement by teleport, there's no way to move an avatar directly with LSL.

llPushObject() is a direct counter-example, but wouldn't be useful for "grid based movement" as it's imprecise.

6 hours ago, Galyo said:

a system that allows you to move your avatar along a fixed grid on the ground like a board game.

I'm too lazy to write out a complete example, but I'd try llMoveToPos(llGetPos()+offset); in an attachment's control event, where offset is determined by the input direction.

  • Like 1
Link to comment
Share on other sites

One option is to "sit" the avatar on a chair or platform, and move that with llSetPos. That's easy to do, and doesn't get you into the permissions problems associated with objects that force an avatar to do something. The platform can be invisible.

Fancier options:

  • You could script the chair or platform as a non-physical vehicle, and capture the arrow keys, so that a push moved you by one square.
  • With enough code, you could enforce the rules of chess or checkers, so only allowed moves would work.
  • The avatar can always stand up and leave the game, of course. But the platform can detect that and record this as a lose.

There's a fencing game called "En Garde" I've seen in a few places in SL. It works like that. You sit on the starting position, and that puts you on an invisible platform. The platform animates your avatar into fencing poses. As you win or lose moves, you move forwards or backwards along a long fencing mat. Whomever gets forced to the end of the mat loses.

Link to comment
Share on other sites

You can move an avatar's attachment to a location using physics; which then forces the avatar to move... unless that's been changed, but I don't think it would have been since it would have been a fundamentally breaking change to a lot of things in SL. But, you cannot change their direction. 

However, if you want to go beyond the standard and use RLV (built into Firestorm, etc) then you can force teleport avatars, force sit them, force move them, etc.

Link to comment
Share on other sites

If a lack of precision is acceptable and you don't want avatars to sit:-

llMoveToTarget calls from an attachment will move the wearers avatar to about the desired position so long as it's not too far away..

llApplyImpulse and llSetForce I believe both work on avatars if called from an attachment... don't quote me on that. You'd have to build a more advanced mechanism to use these though with some sort of feedback loop.

Rotating the avatar is not really possible via LSL alone (afaik) but can be done via RLV (with the usual imprecision)

 

Link to comment
Share on other sites

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