|
Scott Deharo
OMGTHISISAREALLYLONGTITLE
Join date: 28 Aug 2006
Posts: 614
|
06-03-2007 19:55
Hi, I'm making a RC car and I need two scripts, one for the controller and one for the RC. Here's how I think it should work and it should work good: The RC car communicates with the controller telling it where to point it's camera using llRegionSay. I've attempted this but I can't get it to work dang it! Please and thank you! Here's what I got so far: The RC Camera: default { state_entry() { llSetTimerEvent(.01); } timer() { llRegionSay(5465465454, (string)llGetPos()); } }
The controller: default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA); llListen(5465465454, "", "", ""); } listen(integer channel, string name, key id, string message) { setcamerastuffhereto the positions } }
Please help and thank you! Btw feel free to use this idea in your RC Vehicles 
_____________________
The SL Sun is much to big, time to update the SL Header... 
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-04-2007 01:35
You say it doesn't work; *how* doesn't it work? But, from a design standpoint, a few problems come to mind:
As far as I know, only things that are attached or sat upon can control an avatar's cam, but perhaps the controller would be an attachment anyway.
llRegionSay() will obviously not work if the car crosses into a different sim from the controller. Not sure the advantage of using llRegionSay() over llShout() anyway: are you really hoping to control it beyond 100m?
How are you moving the car, kinetically or kinematically? If you're just doing llSetPos() on it, then your controller knows where to look anyway, but if you're pushing it physically (which is probably more realistic) then you do need to "find" it somehow; it's anyone's guess whether the llListen() is better or worse than a tightly filtered llSensorRepeat().
The timer won't come anywhere close to firing at a 0.01 second rate, but it will try, gobbling as much CPU as the sim will allow. That is to say, it will contribute substantially to sim lag (but I'm guessing this will just double an already CPU-hungry position- or force-updating loop).
Especially if the controller is busy with other stuff in the same state, it will fall further and further behind the position updates from the car, so the cam will gradually lag the car's position (not exactly sure what happens when the listen() event buffer overflows) so the llSensorRepeat() approach might be better.
Out of curiousity, what do you intend the cam to do: to look *at* the object, or to pretend to *be* the object?
|
|
Scott Deharo
OMGTHISISAREALLYLONGTITLE
Join date: 28 Aug 2006
Posts: 614
|
06-04-2007 10:03
It would be used for like spying in sim. It uses llMoveToTarget for movement.
_____________________
The SL Sun is much to big, time to update the SL Header... 
|