HowToC:FollowAnObject
From S2PLOT
How to follow an object with the camera
Using handles, you can easily detect when an object has been right-clicked. With two pretty simple bits of code, you can then make the camera keep focussed on that object.
1. use a handle callback to register the most recently selected handle:
int camfollow; // initialised to -1 in main
unsigned char *selected; // array storing selected state of all handles
void pickcb(int *id) {
// ...
}
2. in the standard dynamic callback, set the camera position if required XYZ *iP; // array storing positions of all handles
void callback(double *t, int *kc) {
// ...
if (camfollow >= 0) {
}
}