Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Getting Gamera Angles

Dargon Pacer
Registered User
Join date: 2 Jul 2005
Posts: 19
11-20-2005 20:23
Hi there!
I searched the forums and only saw one reference to this but it never got resolved...
recently I had a need for this so I thought I woul bring it up again in case things have changed..

I am trying to make a set of scripts that will help people to easily use llSetCameraEyeOffset and llSetCameraAtOffset. using 3 objects.. sitball, Camera, and Camera_Aimer

..basically position all 3 and touch each one it would tell you the Offsets.

It seems the vectors for llSetCamera...are related to the position of the SitBall..so I have to have each object (the aimer and the camera) locat the position of the sitball and give coords relative to that ..correct?

Is there something out there that does this already ?
If not, Is there someone out there that would like to help me make one?

What I would like to do is this:

Object 1: SitBall - rez and rotate as you like.
Object 2: Camera - rez and position, touch will give you llSetCameraEyeOffSet vector
(relative to SitBall)
Object 3: Camera_Aimer - res and place exactly where you want the camera to point, touch and it will give you the llSetCameraAtOffset vector relative to SitBall.


llSetCameraEyeOffset(<0, 0, 0>;); // defines postion of camera
llSetCameraAtOffset(<0, 0, 0>;); // what camera looks at
llGetCameraPos(); // Gets current camera position for agent.
llGetCameraRot(); // Gets current camera orientation for agent.

The WIKI also mentions something about getting permissions using PERMISSION_TRACK_CAMERA, but I dont know if this is relevant here..


As I understand it, llSetCameraEyeOffset sets the position of the camera

llSetCameraEyeOffset(<2, 0, 0>;); would set the camera 2 meteres in front of the SitBall,
llSetCameraEyeOffset(<0, 2, 0>;); would set camera at 2 meters to the LEFT of the SitBall,
llSetCameraEyeOffset(<0, 0, 2>;); would be 2 meters ABOVE the sitball.
llSetCameraEyeOffset(<-2, 0, 0>;); would be 2 meteres BEHIND the SitBall,
llSetCameraEyeOffset(<0, -2, 0>;); would be 2 meteres to the RIGHT of the SitBall.
llSetCameraEyeOffset(<0, 0, -2>;); would position camera 2 meters BELOW SitBall.

llSetCameraEyeOffset defins the place you want that camera to LOOK at

llSetCameraAtOffset(<2, 0, 0>;); would look 2 meteres in front of the SitBall
etc, etc..(just like above)

There is not much help for this in the WIKI and I think it would be used alot more if there were.

As for the tool-set I want to make, I think it would be handy to just move these 3 prims around, click on each one and have it provide the vectors for you.

Unfortunaly, I am not a very good scripter yet so I am not sure how to tell the other 2 objects to track the SitBall and get local coords based on the location of said SitBall..

Anybody out there care to help out a little?

(by the way, if we figure this out, I would liek to post it as FREE in the forums so that others can use it and possibly come up with something better as SL evolves)


Thanx!!
Dargon Pacer
Dargon Pacer
Registered User
Join date: 2 Jul 2005
Posts: 19
hrmm
11-26-2005 16:13
Well, I guess this was stupid idea er something..
I will keep working on it and when I get it done if you want a copy IM me.

close thread please..

Thanx,
Dargon
Gabe Lippmann
"Phone's ringing, Dude."
Join date: 14 Jun 2004
Posts: 4,219
Apologies, I couldn't resist....
11-26-2005 16:34
Great Gamera angle!
_____________________
go to Nocturnal Threads :mad:
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
11-26-2005 21:36
CODE

string SUBJECT_NAME = "Subject";
string CAMERA_NAME = "Camera";

notFoundMessage(string object, string name) {
llOwnerSay(object + " nof found.");
llOwnerSay("Rez an object named \"" + name + "\"");
llOwnerSay("And position it where the "+ object +" should be.");
}

default {
touch_start(integer tn) {
state getCameraPos;
}
}

state getCameraPos {
state_entry() {
llSensor(CAMERA_NAME, NULL_KEY, ACTIVE|PASSIVE, 96, TWO_PI);
}
sensor(integer det) {
vector offset = llDetectedPos(0) - llGetPos();
llSetCameraEyeOffset(offset);
llOwnerSay("Camera offset: " + (string)offset);
state getSubjectPos;
}
no_sensor() {
notFoundMessage("camera", CAMERA_NAME);
state default;
}
}
state getSubjectPos {
state_entry() {
llSensor(SUBJECT_NAME, NULL_KEY, ACTIVE|PASSIVE, 96, TWO_PI);
}
sensor(integer det) {
vector offset = llDetectedPos(0) - llGetPos();
llSetCameraAtOffset(offset);
llOwnerSay("Subject offset: " + (string)offset);
state default;
}
no_sensor() {
notFoundMessage("subject", SUBJECT_NAME);
state default;
}
}


Drop this script in an object and rez two cubes. Name one "Subject", the other "Camera". Move Subject to where the camera should look and move Camera to where the camera should be. Then click the scripted object.

Cheers :D
==Chris
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
Torley Linden
Enlightenment!
Join date: 15 Sep 2004
Posts: 16,530
11-26-2005 21:36
From: Gabe Lippmann
Great Gamera angle!


Gabe, that's the first thing I thot of too. In all seriousness, useful info.
_____________________
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
11-27-2005 02:38
I'm third... :o
But Gabe, I had a feeling that you had already posted just when I saw that title. :p
_____________________
:) Seagel Neville :)
Dargon Pacer
Registered User
Join date: 2 Jul 2005
Posts: 19
Wow!
12-04-2005 15:10
Very kewl!
Thank you VERY much Chris!!

Now all we need is an " llSetCameraRotation(<x,x,x>;) " !!

Actually, if there is a way to get the current rotation of the object with script in it and adjust accordingly...that would probably do it too..

(but I still think we need an llSetCameraRotation command)


something with
vector CameraRotation = llGetLocalRot();


GameraRotation...go ahead and post a rotated Gamera pic.. you KNOW you WANT to!! hehe