Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Asking for Help (with Trepidation) on an Attachable Vehicle

ItsNaughtKnotty Cannned
Registered User
Join date: 22 Nov 2006
Posts: 18
01-22-2007 19:06
I have searched through the library files and the animation files and honestly tried to find some leads on how to do this and have come up with a zero, so I seek your help and hope I'm not violating any etiquette on this forum (i.e., I'm new):

I'm creating an "attachable linked prim that will function as a vehicle." Basically I want to attach a prim to my avatar, have the avatar assume a static pose through animation, and then move the animation around with the normal arrows without the avatar automatically walking.

I've been able to figure out the prim attachment and the animation, but the scripting has me stumped. None of the available freebies in the scripting library here seem to accomplish this goal. There are two free vehicles in-game (the wheelchair and the NN Bike) that do what I want them to, but both creators of those vehicles have told me they're too busy to help me (and their scripts are not open to the public).

So I'm seeking guidance here from someone with more time and experience.

Any suggestions of how to script this? Thanks for your patience and help.

INK
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
01-23-2007 00:47
Generally there is no scripting at all for movement, the avatar is moving around like it always has but the usual animations are over-ridden. Just use a priority-4 animation to keep everything else supressed. (There's a sticky in the animation forum that goes over priority and joint locking.)

You can effect the way the av moves by taking the controlsand using llApplyImpulse and its physics sisters. This is usually not nessesary. You can also use the cpntols to trigger new animations for the dirction of movement.
_____________________
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
01-23-2007 17:43
the one exception to this (that I can think of) would be "flight attachments". They are a sort of a combinations "attachment/effects/animation overrider" (like the wheelchair, bike, seguey, rollerskates, etc) combined with a few physics scripting bits that allow you to fly higher or faster than normal.

But to explain a bit about how these other wearable vehicles work.. you must first realize that your avatar is not "you". you, in game.. are an "Agent".. a 2 meter tall box or cylander.. It's invisible.. so don't go looking for it. Most times, when you are standing.. the Agent is right where your avatar is. When the agent moves at walking speed, it triggers an animation in the avatar. So the avatar looks like it's walking. There are a default set of animations for "walk, run, jump, land, turn left or right, sit, etc. And there are 5 stands.

Most AO's will allow you to override these animations (franimation being the best I've found for the job).

Now here's the thing. the agent is gonna do the same basic moves.. walk, run, turn, stands 1-5, etc. It's your job, as the designer, to create new animations for the avatar.. and a prop that works with these animations. If you're making a hoverboard.. you'll probably want to raise the avatar half a meter off the ground in the animation program. This won't change the height or position of the agent.. but it will move the avatar.

Why is all this important? what value is teh agent?

Here's one.. the wheelchair. while standing, the agent is the same height as before. Even if the animation makes the avatar sit, the agent is still 2m tall. the agent is the only "solid" thing about your avatar. (ever notice how your hands can go through walls, and how your swords and whatnot can too?) Well if you sit your avatar down in a wheelchair.. that wheelchair is phantom.. and so is your avatar.. but you're still toting around a full height agent. So even though it looks like you can roll through a lower space.. you can't.

The agent is as tall as the slider height of your avatar (and is related also to your mass in the physics engine)

So basically.. if you raise your avatar up.. don't be surprised if his head becomes phantom. if you scrunch him down, don't be surprised when things dropped on you stop half a meter before hitting you.

I wish I knew more anout the dimensions of the agent.

I do know one thing.. I have some physical go carts.. they hang up on low barriers because the agent smacks into them.

Here's my sketch of how I think of the agent.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Valradica Vanek
Registered User
Join date: 1 Aug 2006
Posts: 78
vehicles attdhed
01-23-2007 18:44
typically, vehicles are not attached but you "sit" on them. When you sit on a vehicle, you can define the sit target so that the rotation and location relative to the target are set. Once the Avatar is seated, you can overide the sitting animation with your own animations. the advantage of sitting on a vehicle is that with linked prims, you can have multiple sit targets for the same vehicle, whereas attached prims do not allow others to Sit on the vehicle.

I am currently working on a vehicle that imitates the common mov3ements of flying, walking, ambling, walking on water, automatically going into fly mode ifyou step off a cliff and then allowing me to walk along side another or fly with them. Its working pretty well, but its a lot of work to coordinate all the animation changes and sensing objects and stuff like that. If you are interested, look me up when I am in world and I can show you what I have. The code is rather complex and there is a lot of trial and error to get the LSL commands to work a one thinks they should.

Basically, I suggest that you dive into the wikified Vehicle tutorial and just start messing with your own vehicle until you "get it" - then learn animations and animaion over-riding and then start putting it together. Its tough and the vehicle settings can be rather complex to get a nice looking movement.

I am ingame a fair amount, and will be glad to talk - but you will have to invest a fair amount of your own noggin to make it work.

Valradica Vale
ItsNaughtKnotty Cannned
Registered User
Join date: 22 Nov 2006
Posts: 18
WOW Thanks Guys!
01-23-2007 23:54
I am so heartened by these thorough responses. Thank you all!!!
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
01-24-2007 06:29
Well, hope I'm not giving away trade secrets, but it seems the description for what an "Attachment Vehicle" is and how the common version is done is missing here.

Basically, a true vehicle is something that incorporates physics. An attachment might be able to use the physics of your avatar to react to certain situations, but they have no true physics themselves and will basically act like phantom prims.

The typical way an attachment vehicle is done is build the vehicle using as many prims as you need, and then you create a 'hitbox'. Which is a basic set of prims that encloses the main shape of the vehicle and perhaps incorporates parts of the outside shape. It's usually best to build the basic hull of the ship and then create the details and interior parts as the attachment. You just make sure that the actual scripted vehicle doesn't exceed your prim limits (31) counting all passengers, but the attachment part can use the full amount allowed for a linkset.

What you'll end up doing is sitting on the main vehicle, and attaching the extra parts to your avatar to a part that will not move while you are seated in the real vehicle, and will remain the same for as many size AV's as possible. (around the waist area is best) You then have to move the attachment to a place where it will appear to be part of the vehicle you're sitting on.

The reason for the hitbox is so your ship attachments will not phantom through items in the world. So if you were to make an X-wing the hitbox would have an "X" shape, and a tie fighter would have an "H". You can use parts of the ship for this, or you can just create the hitbox out of transparent prims.

There's some scripting that would need to be done to make the ship appear whole at all times, or you can do it the cheap way and just have them attach manually before or after they sit on the hitbox.