Go Back   AC3D Forums > Technical > AC3D Developers
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 17th February 2011, 02:15 PM   #1
wegnif
Junior Member
Member
 
Join Date: Oct 2009
Posts: 10
Default Get/Set Camera Position From C++

How do I get the position of the 3D camera from the PlugIn interface? I want to programmatically generate screenshots at different positions and orientations.

I've tried ac_object_get_centre(ac_views_get_default_camera() ), and it gives the position of something, but it doesn't seem to change as I move the 3D view around.

Once I get the position, how can I move the camera? ac_camera_move_forward() doesn't seem to do anything either.
wegnif is offline   Reply With Quote
Old 18th February 2011, 04:42 AM   #2
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 3,795
Default Re: Get/Set Camera Position From C++

Almost, but the camera is not an ACObject.but an ACEntity.

Once you have the ACCamera from
ac_views_get_default_camera(),
you should be able to use the ac_entity_set/get* functions to set/get the values. (origin (Point3), location
(Point3), rotation (Point3), spin (Point3), scale (float), move_dist (float), move_angle (float), walk_vehicle (Boolean), offset (Point3), fov (float))

The ac_camera_move_* functions should work fine although you may need to redraw the view after(?) You must ensure that it's in walk mode for many of the functions to work, since they don't make sense in spin mode.

You may also find that a lot of this can be done from a script too. You can also call tcl_command(char *) with a script command inside your plugin.







Andy is offline   Reply With Quote
Old 18th February 2011, 10:44 AM   #3
wegnif
Junior Member
Member
 
Join Date: Oct 2009
Posts: 10
Default Re: Get/Set Camera Position From C++

Thanks Andy, that did it!
wegnif is offline   Reply With Quote
Old 15th March 2011, 11:59 AM   #4
wegnif
Junior Member
Member
 
Join Date: Oct 2009
Posts: 10
Default Re: Get/Set Camera Position From C++

It seems that 'direction' is also one of the values that can be set.
wegnif is offline   Reply With Quote
Old 29th June 2011, 12:24 PM   #5
wegnif
Junior Member
Member
 
Join Date: Oct 2009
Posts: 10
Default Re: Get/Set Camera Position From C++

Is there a way in Walk mode to change the camera's roll angle? I've tried the rotation and spin properties and they don't seem to have any effect.
wegnif is offline   Reply With Quote
Old 30th June 2011, 06:07 AM   #6
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 3,795
Default Re: Get/Set Camera Position From C++

Sorry, no, 'up' is fixed.
Andy is offline   Reply With Quote
Old 2nd October 2011, 10:13 PM   #7
jmaida
Junior Member
Member
 
jmaida's Avatar
 
Join Date: Sep 2005
Posts: 10
Default Re: Get/Set Camera Position From C++

This has nothing to do with get/setting camera (but that was useful information). I just using this thread to get this question out. How is the URL used in the object property entry? I mean I enter URL, but so what. I can't see how it is acted on by anything in AC3D or by the object.
jmaida is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 11:04 PM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
(C) Inivis Limited 2014