[SOLVED] How to get camera position of currently active camera?
by Keith G Wood · in Technical Issues · 08/19/2011 (8:01 am) · 2 replies
The problem I want to solve is to spawn a particle emitter at a fixed relative offset to the currently active camera position. To do this I need to read the postion of the camera (at least), and preferably the rotation as well (I could infer the rotation from the main player's rotation).
I am using the same default camera as comes with a new project. So it can be in either 1st or 3rd person view (tab key). I am aware that in a default new project I can use ALT-C to toggle between a player-tracking camera, and a camera that seems to be fixed at the player's original spawn location. (However I have disabled the ALT-C action, and dont use this fixed camera).
I have tried the following code, but it returns me the position of the camera located where the player was originally spawned...
I have tried the following, but it appears to return me the location of the eyes of the player...
This seems like such a fundamental item, I'm sure it must be possible. I just don't know how to get a handle on the currently active camera. I've tried searching forums but I can't seem find out how to do it.
Any help greatly appreciated.
I am using the same default camera as comes with a new project. So it can be in either 1st or 3rd person view (tab key). I am aware that in a default new project I can use ALT-C to toggle between a player-tracking camera, and a camera that seems to be fixed at the player's original spawn location. (However I have disabled the ALT-C action, and dont use this fixed camera).
I have tried the following code, but it returns me the position of the camera located where the player was originally spawned...
%temp = ClientGroup.getObject(0); %temp.player.client.camera.getTransform();
I have tried the following, but it appears to return me the location of the eyes of the player...
%temp = ClientGroup.getObject(0); %temp.player.getEyeTransform();
This seems like such a fundamental item, I'm sure it must be possible. I just don't know how to get a handle on the currently active camera. I've tried searching forums but I can't seem find out how to do it.
Any help greatly appreciated.
About the author
The perverse mind behind Bad Taste Software: http://www.badtastesoftware.co.uk
Torque Owner Bryce
Toy Story 2 was O.K.