Laen Teazle
Registered User
Join date: 15 Sep 2005
Posts: 4
|
09-30-2005 08:26
Okay, so I spent some time building a vehicle, but then when I applied the car script, I noticed that what _I_ thought was the front of the car is actually the lefthand side of the car.
So, while the car _looks_ like it's pointed in one direction, when you get in, going "forward" actually moves the car along sideways.
Is there a way to "reset" the orientation of this vehicle, so that "forward" aligns with what the model looks like?
|
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
|
09-30-2005 08:47
Always build vehicles so that they face east with zero rotation before you put the script in. At zero rotation, the eastern side of a prim is what SL considers to be the "front". If your car is moving sideways, it's probably because you built it facing North or South. Had you built it facing West, it would now be movig backwards. To solve the problem, rotate the parent prim 90 degrees so that its front faces the direction of forward motion. You may have to do a little reshaping of it, depending on what it is.
The parent prim, by the way, is the last one you selected when you linked the entire vehicle. When you select the car, the parent will be the one highlighted in gold. It should also be the one that the main script resides in. For vehicles, it's best to place the parent prim wherever the vehicle's center of gravity is.
_____________________
.
Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
|
Chandra Page
Build! Code. Sleep?
Join date: 7 Oct 2004
Posts: 360
|
09-30-2005 10:30
To clarify a little, the eastern side of a prim with no rotation is the positive X side of the prim in its local frame of reference. Positive X on the root prim will always be the "front" of a vehicle. There is a way to change this frame of reference via script, though. You can call llSetVehicleRotationParam with the VEHICLE_REFERENCE_FRAME constant to change which direction the vehicle considers to be the front. For example, I think this will rotate the frame of reference on your vehicle so that instead of the left side, the front side is actually front: rotation rot = llEuler2Rot(<0, 0, -PI_BY_TWO>); llSetVehicleRotationParam(VEHICLE_REFERENCE_FRAME, rot);
This should rotate the vehicle's frame of reference 90 degrees clockwise (PI / 2 in radian measurement) about the Z axis. If you find it actually makes the back end into the front, then remove the negative sign from the front of PI_BY_TWO. I think that LSL rotation follows the right-hand rule, but I'm not positive on that.  Of course, it's far, far simpler to orient the positive X axis of the root prim to the front of the vehicle when you first build it; no scripting is required, and you don't have to muck about with rotations. That's not much help when you've already built the vehicle, but it's good, sound building advice for any future vehicles you wish to build. (I'm still sitting here with my fingers contorted into little axes, rolling them about in front of me as I attempt to visualize the rotation. Yuck.)
|
Laen Teazle
Registered User
Join date: 15 Sep 2005
Posts: 4
|
That did the trick.
10-05-2005 08:03
Yay! That did the trick.
Thanks!
|