Thing is, I try to let my script rez something right in front of me, facing the direction I am facing.
The direction it faces, thats all fine, but the position...
Its asif its mocking me! =P
Instead of rezzing right in front of me, it rezzes a few metres off from my position, yet facing the right direction. If I turn around without walking, it'll rez at the same spot, but facing the right direction, being where I am looking.
What tests have I afterwards done:
I tried a single cube, it rezzed perfectly in front of me, in all directions.
I linked up to four different kinds of basic prims, sphere, cylinder, cube, and prism.
That went wrong, somehow! So it makes me to believe that using this script with an object existing out of multiple prims makes it go wrong, SOMEHOW...
I made a seperate script of it, because its normally implemented in a script thats quite valuable and is rather not given out.
Take not, ive tested it with this script then too, and yet I get that problem.
I will paste it below:
//========================
integer armed = TRUE;
vector vel; // Used to store velocity of arrow to be shot
vector pos; // Used to store position of arrow to be shot
rotation rot;
float SPEED = 25.0; // Speed of arrow in meters/sec
integer LIFETIME = 7; // How many seconds will bullets live
// before deleting themselves
float DELAY = 1;
//Anims
string ChaosFire = "ChaosFire";
//Sounds
string ChaosSound= "sChaosSound";
fire()
{
//
// This subroutine creates and fires an arrow
//
if (armed = TRUE)
{
//
// Actually fires the arrow
//
// strike_type = FLIP;
// armed = FALSE;
rot = llGetRot(); // Get current avatar mouselook direction
vel = llRot2Fwd(rot); // Convert rotation to a direction vector
pos = llGetPos(); // Get position of avatar to create arrow
pos = pos + vel; // Create arrow slightly in direction of travel
pos.z += 0.75; // Correct creation point upward to eye point
// from hips, so that in mouselook we see arrow
// travelling away from the camera.
vel = vel * SPEED; // Multiply normalized vector by speed
//llStartAnimation("shoot_R_handgun"
; // Trigger the bow release animation// llRezObject("Chi Chaos Blast", llGetPos() + <0, 0, 0>, ZERO_VECTOR, ZERO_ROTATION, 42);
llRezObject("Chi Chaos Blast", pos, vel, rot, LIFETIME);
// llRezObject("Chi Chaos Blast", llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
llTriggerSound(ChaosSound, 0.3); // Make the sound of the arrow being shot
llStartAnimation(ChaosFire);
// Create the actual arrow from object
// inventory, and set its position, velocity,
// and rotation. Pass a parameter to it to
// tell it how long to live.
llSetTimerEvent(DELAY); // Wait until can fire again
}
}
default
{
state_entry()
{
llSay(0, "Hello, Avatar!"
;}
touch_start(integer total_number)
{
fire();
}
}
//========================
I really have no bloody idea why it goes wrong. Test it for yourself.
A single cube does fine ; one with multiple prins, four prims, for example,
in a formation of the corners of a square...goes wrong!
So either its SL's system for objects scr-wing up, or its the script.
Please help, this part of my script is VITAL to the success of it that I have in mind.
Kind regards
~Lou