|
Xylo Quisling
Registered User
Join date: 1 Feb 2007
Posts: 146
|
08-07-2007 05:46
I've asked this question yesterday already, but somehow the word 'fish' in the title frightened or bored people away; few views, and no answers.
So I try again: I have heard of a script, possibly a freebie (though I don't mind paying), for 'movement in a confined space'. I need some starting point to script my fish to swim; being a beginning scripter, I'll make a hash of it without some starting point, notwithstanding the fact that I generally take a whole day to make even a small script.
So, does anyone know about such a script, or have some suggestions for functions to use, etc., when making a fish swim in a walled pool?
Thanks,
Xylo
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
08-07-2007 06:17
Well, I haven't tried it, but  looks as if it may be relevant.
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
08-07-2007 06:18
A few approaches you might take: Use llVolumeDetect http://rpgstats.com/wiki/index.php?title=LlVolumeDetectOr make sure the fish knows the boundaries of its tank, and turns before getting there. Or the fish could use llSensorRepeat calls.
|
|
Hg Beeks
llGetElement(80);
Join date: 13 Apr 2006
Posts: 134
|
08-07-2007 10:42
When I was working on something like this, I went with the Sensor option that RJ suggested. Another method other than doing repeated sensor calls is an "Invisible Fence," which utilizes two or three objects on start-up: the fish, and one or two sensor "beacons." When the fish is rezzed, it does a single sensor sweep, looking for any object in range of it that has the name "Fish Beacon," or whatever you've called it. It stores the location of the beacon or beacons in vectors. If it only finds one, then it will prompt the user for a radius for each direction, and then move as usual. Every few seconds, it will do a check to make sure that it's inside BeaconLocation.x + Radius and BeaconLocation.x - Radius, etcetera, and if it isn't it will move back towards the beacon's location. If it finds two, then it treats those as opposite corners of a box, and checks to make sure that its x is between Beacon1.x and Beacon2.x. Because the sensor is only called once, you don't have to keep the beacon on your land, either, so you save yourself the prims.
|
|
Xylo Quisling
Registered User
Join date: 1 Feb 2007
Posts: 146
|
08-07-2007 11:37
Thank you, Qie, RJ and Hg. I'm presently looking into all you three have suggested. We will see how that goes!
Xylo
|
|
Xylo Quisling
Registered User
Join date: 1 Feb 2007
Posts: 146
|
08-07-2007 13:44
Well, I won't be making you three kind advisors proud of me, today....I'm still stuck at the bare basics. I'm not even sure how to make the fish move to begin with - I've tried llSetForce and llApplyImpulse, but neither moved the beast a bit. I'm completely out of my depth, pun semi-intended, and can't find a basic, simple script for movement in water that would lay bare some of the essentials.
|
|
Hg Beeks
llGetElement(80);
Join date: 13 Apr 2006
Posts: 134
|
08-07-2007 18:43
If you'll be around at 10-10:30 SLT tonight, I might be able to help you out in-world, if that would be any assistance.
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
08-08-2007 09:55
i have messed around with this type of problem, too, and never really gotten anywhere. But, some things I might know...
You can llSetBouyancy(1) to make it not sink. You can also set a permanent llForce upward at an intensity of llGetMass() to get a similar effect.
Simplest might be to set it's original position, and then never go too far from that.
Try llMoveTotarget().
Basic model might be
forever... If far from start, turn toward start, else turn to some random direction. move forward some small random amount.
A lot of animated objects like this have one script for the "brain" that decides where to go next, and then sends a message to another script that does the work of trying to get there.
I haven't had hardly anytime for SL the last few weeks. But if you drop any experiements on me, I'd be glad to take a look at them.
|
|
Jana Crispien
Registered User
Join date: 13 Jul 2006
Posts: 24
|
08-09-2007 01:01
I'm messing with something similar and haven't had a lot of luck. But next time I can go in-world, I'll try the beacon thing.
I am in WAY over my head here.
|