Shymus Roffo Posted October 4, 2015 Share Posted October 4, 2015 So, i've taken into learn Camera Functions. While doing that i'm trying to make an RC car with a camera hooked on it.While doing that i've been having problems with keeping the camera facing forward with the Focus. I'm pretty sure my equitation to get the point in front of it based on the rotation is incorrect... The object is not a car you sit on, a camera follow script is not the result i'm looking for. It's an RC Car that is controlled with a controller. You wear the controller and the controller updates the camera every 0.1 seconds.What i'm trying to do is get a point in front of the object based on the rotation and position. Example below.The red point is not linked.Now when that center ball rotates, i'm trying to get the position of the red point. Sadly, i've been very unsuccessful. I'm doing all this for Camera Focus for when an object turns, like a controllable camera. Sadly i haven't been able to find any other way to go about this.Below is the way i've been getting the point in front of the prim.list d = llGetObjectDetails(robot_uuid, [OBJECT_POS,OBJECT_ROT]); vector pos = llList2Vector(d,0); rotation rot = llList2Rot(d,1); //llClearCameraParams(); // I don't know if this is required? llSetCameraParams([ CAMERA_ACTIVE, 1, CAMERA_BEHINDNESS_ANGLE, 0.0, CAMERA_BEHINDNESS_LAG, 0.0, CAMERA_DISTANCE, 10.0, CAMERA_FOCUS, (pos+<1,0,0>)*rot, // Set the camera rotation. (Incorrectly...) CAMERA_FOCUS_LAG, 0.05 , CAMERA_FOCUS_LOCKED, TRUE, CAMERA_FOCUS_THRESHOLD, 0.0, CAMERA_PITCH, 0.0, CAMERA_POSITION, pos, // Set the camera position. CAMERA_POSITION_LAG, 0.0, CAMERA_POSITION_LOCKED, TRUE, CAMERA_POSITION_THRESHOLD, 0.0, CAMERA_FOCUS_OFFSET, <0,0,0> ]); Link to comment Share on other sites More sharing options...
Qie Niangao Posted October 5, 2015 Share Posted October 5, 2015 Try changing (pos+<1,0,0>)*rot to pos+(<1,0,0>*rot) Note, however, that this is never going to be a really smooth cam-tracking experience, regardless of how tight the timer loop is set. It may be okay for the purpose, I'm not sure, but there's a lot of communications overhead between the script running on the sim and the cam of the viewer. It can never be anything like frame-rate real time. Link to comment Share on other sites More sharing options...
Shymus Roffo Posted October 5, 2015 Author Share Posted October 5, 2015 Eh. That wouldn't have worked. I had to put in some triginometry. Luckily i got it working, thanks for the help! Link to comment Share on other sites More sharing options...
Recommended Posts
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