Game Development Community

Death cam? [Solved]

by Dustin Mellen · in Torque 3D Beginner · 09/09/2010 (1:44 pm) · 5 replies

I'm trying to force my camera to stay put when I delete the player after death. At the moment, the camera snaps back to the spawn point. I want to replace the player with a particle effect when the player dies, wait 5 seconds, and then re-spawn the player. The game is a side scrolling platformer.

This is the script I use for the camera:

localClientConnection.camera.setOrbitObject(localClientConnection.player, "0 0 0", 0, 10, 10, true, "0 0 0", true);  
   localClientConnection.setCameraObject(LocalClientConnection.camera);  
   localClientConnection.setControlObject(LocalClientConnection.player);  
   serverConnection.setFirstPerson(false);

#1
09/09/2010 (2:45 pm)
This would be interesting. Once you get this working you should at it to the resource page
#2
09/09/2010 (4:23 pm)
Since your "GameBase orbitObject" is set to "localClient Connection.player" and that no longer exists once the player dies and the object disappears, couldn't you change the camera mode from OrbitObject to Stationary?
#3
09/09/2010 (6:35 pm)
@Jerry

The console says the function Stationary from Camera.Stationary()doesn't exist.

Edit:

After looking at the documentation for the camera, I realize that I was using stationary wrong. Nevertheless, that doesn't make any difference. The camera still snaps back to the spawn point.
#4
09/11/2010 (2:55 am)
The only solution I can come to is changing the control object the camera is set to orbit. What I can't figure out is how I can drop an invisible object that I can set the camera to target just before the player is deleted. As far as I can see the function to control the camera should be as such:

function playerCam(%target)
{
   localClientConnection.camera.setOrbitObject(%target, "0 0 0", 0, 10, 10, true, "0 0 0", true);  
   localClientConnection.setCameraObject(LocalClientConnection.camera);  
   localClientConnection.setControlObject(%target);  
   serverConnection.setFirstPerson(false);
}

Then I can have the player "drop" a non-rendering object the camera can target, set that as the control object, and then delete the player object. My only quandary is how to drop an invisible object like a marker. I tried it once before, but I think I got the script wrong. Can a marker be a target of the camera?
#5
09/23/2010 (2:56 pm)
Solved!

deathCam(%player.getEyePoint());

function deathCam(%position);
{
localClientConnection.camera.setOrbitPoint  ( %position @"0 0 0", 10, 10, 10, "0 -9 0" );
}

I don't know if the min/max/cur distance matters, but the offset needs to be one less than the camera's initial offset for reasons unknown to me.