Jump to content
  • 0

I am trying to make an aquarium with fish that swim around in it, but am having a problem.


LuckyCreations1488303085
 Share

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

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

Question

I am trying to make a fish aquarium with fish that swim around in it. I found a script that allows a prim to orbit around a specified object. I got the fish to be able to orbit around, but the angle it is facing is not right. Since the fish is a flexi prim, the prim has to be facing a certain direction for it to look right.

Here is the script I am using:

vector root; 
float ellipse_x;
float ellipse_y;
float angle = 0;

string axis_name = "Tank";

default {

on_rez( integer Parameter ) { llResetScript(); }

state_entry() {

root = llGetPos(); // default axis is around myself (sensor will update)

ellipse_x = 1.0; // r_max these will control the size and shape of the elipse
ellipse_y = 1.0; // r_min

llSetTimerEvent( 0.2 ); // or more depending how smooth and fast it's to be

// non moving target
llSensor( axis_name, NULL_KEY, PASSIVE | ACTIVE, 20.0, PI ); // 20m range
// moving target
// llSensorRepeat(axis_name, "", 20.0, ACTIVE | PASSIVE, PI, 2.0); // 20m range
}

timer() {

angle += 5.0 * DEG_TO_RAD; if( angle >= TWO_PI ) angle -= TWO_PI;
float x = ellipse_x * llCos(angle);
float y = ellipse_y * llSin(angle);
llSetPrimitiveParams( [ PRIM_POSITION, root + <x, y, -.5>, PRIM_ROTATION, llEuler2Rot( <0.0, 0.0, angle> ) ] );
}

sensor(integer num_detected)
{
root = llDetectedPos(0);
}

no_sensor()
{
llWhisper(0, axis_name + " not found.");
llSensorRemove();
}

}

 

 

The fish right now has its head facing toward the ground, and its tail toward the top of the ceiling (root of the prim is on the bottom by the fish's head, and the flexi part is on the top by its tail).

 

Here is a pic of what I am talking about:

Snapshot_001.png

 

It needs to be rotated by about 90 degrees somehow, but I am not sure how.

Does anyone have any ideas of how I can get it to rotate by 90 degrees


 


Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

since I can't be sure what axis the head points to it's hard to guess... but one of these four rotations applied in the REPLACE_ME spot should fix it.

 

llSetPrimitiveParams( [ PRIM_POSITION, root + , PRIM_ROTATION, llEuler2Rot( <0.0, 0.0, angle> ) * REPLACE_ME ] );

<0.0, 0.7071067, 0.0, 0.7071067>

<0.0, -0.7071067, 0.0, 0.7071067>

<0.7071067, 0.0, 0.0, 0.7071067>

<0.7071067, 0.0, 0.0, 0.7071067>

 

and for future reference, you're likely to get faster and more complete answers to scripting issues over here

  • Like 1
Link to comment
Share on other sites

  • 0

Hello LuckyCreations very easy fix. I don't know if you fix the problem but there I go anyways :: remove the scrip from the fish, create a new prim, make it transparent attach your fish to it, then select the transparent prim with( edit link what ever is the option )then drop the script on the transparent prim and you are done! make sure to position you fish in the right angle before the link :)

Link to comment
Share on other sites

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