View Single Post
Old 6th March 2005, 11:44 AM   #2
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,565
Default

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);
Andy is offline   Reply With Quote