6th March 2005, 06:49 AM | #1 |
Member
Expert member
Join Date: Aug 2003
Location: Eslöv, Sweden
Posts: 93
|
How to get a camera?
Scratching my head, can't figure out how to access the 3D view's camera using the plug-in SDK.
Assuming the approch would be like call ac_views_get_3d(), and query it's "camera" entity, but the camera is an entity of its own and there's no "ac_entity_get_entity" function. Thanks |
6th March 2005, 11:44 AM | #2 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,565
|
We'll need to add the entity_get_entity function.
You should be able to use: Prototype Boolean ac_entity_get_value(ACEntity *e, char *resname, char *restype, void *valaddr) ACEntity *cam; ac_entity_get_value(e, "camera", "entity", &cam) Remember there may be more than one 3d window - get_default_camera will get the first 3d camera. Code:
ACCamera *cam = ac_views_get_default_camera(); if (cam == NULL) { printf("no camera found (probably no 3d view available) - camera location is default"); ... } else { ac_entity_get_point_value((ACEntity *)cam, "location", &loc); ac_entity_get_point_value((ACEntity *)cam, "offset", &offset); ac_entity_get_point_value((ACEntity *)cam, "direction", &vec); ac_entity_get_float_value((ACEntity *)cam, "scale", &scale); Point3 rotp; ac_entity_get_point_value((ACEntity *)cam, "rotation", &rotp); rotx = rotp.x; roty = rotp.y; ac_entity_get_float_value((ACEntity *)cam, "fov", &fov); ac_entity_get_boolean_value((ACEntity *)cam, "walk_vehicle", &is_walk_vehicle); |
6th March 2005, 12:48 PM | #3 |
Member
Expert member
Join Date: Aug 2003
Location: Eslöv, Sweden
Posts: 93
|
Ah, didn't see that one. No real need for a entity_get_entity then, thanks.
Btw, ac_views_get_default_camera isn't available, its commented out. No problem though, there's the ac_views_get_3d ( or I guess one could use ac_views_get_list and react on some type=6, right?). |
6th March 2005, 03:15 PM | #4 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,565
|
Strange :? I'm not sure why that's commented out. It's exported though so you should be able to put it back in.
The other methods you mentioned will also be fine. Andy |
|
|