Game Camera 2: Quick Release
by Michael Bacon · in Torque Game Engine · 12/03/2007 (5:11 am) · 1 replies
So there are still some bugs I'd like to work out I think and server side interpolation and proper collision and.... well you get the idea but here is a much modified version of my original GameCamera that should be easier to use and or extend.
The camera is not perfect, far from it, but I am learning and growing and so is it.
You can now tie the mouse wheel to zoom the camera.
Free look also allows the camera to look around <-- try this!
These files are setup to be located in folder named engine/game/reactor. If you change this you will need to modify a couple of include lines.
You can get the new files here
Basically follow the same instructions to implement the camera as found here.
Then add the enhancements I mention here.
The coolest feature I think also introduces the biggest problem (of course). While free-looking the player will fire where the camera is pointing! Thats great! Now you you need to do is rotate the player to face that direction while free looking. Currently he will happily fire to the side or behind him wherever you are looking.
Finally check out all the new datablock members and their default values:
I'm really tired and pressed for times so this is all for now. I hope implementation goes well, let me know if there are problems.
-Brian
The camera is not perfect, far from it, but I am learning and growing and so is it.
You can now tie the mouse wheel to zoom the camera.
Free look also allows the camera to look around <-- try this!
These files are setup to be located in folder named engine/game/reactor. If you change this you will need to modify a couple of include lines.
You can get the new files here
Basically follow the same instructions to implement the camera as found here.
Then add the enhancements I mention here.
The coolest feature I think also introduces the biggest problem (of course). While free-looking the player will fire where the camera is pointing! Thats great! Now you you need to do is rotate the player to face that direction while free looking. Currently he will happily fire to the side or behind him wherever you are looking.
Finally check out all the new datablock members and their default values:
lookAtOffset.set(0.0f,0.0f,2.0f); thirdPersonOffset.set(0.0f,-2.0f,2.0f); minLookAngle = -70.0f; maxLookAngle = 85.0f; maxFreeLookAngle = 95.0f; useTargetLookAngles = true; observeThroughObjects = true; allowCameraYaw = true; allowCameraPitch = true; allowCameraZoom = true; allowFirstPerson = true; allowFreeLook = true; collisionMask = StaticTSObjectType | StaticRenderedObjectType | StaticShapeObjectType; cameraZoomMinDist = 0.5f; cameraZoomMaxMult = 2.0f; useFixedEyeHeight = true; fixedEyeHeight = 2.3f; zoomSpeed = 1.0f / 3.0f; moveSpeed = 30.0f;
I'm really tired and pressed for times so this is all for now. I hope implementation goes well, let me know if there are problems.
-Brian
Torque Owner Michael Bacon
Default Studio Name
Anyways if you crash in updateCameraStats() just make the following change (in bold):
if (ri.object) { id = ri.object->getId(); [b]if (ri.object->getName())[/b] dStrncpy(name, ri.object->getName(), sizeof(name) / sizeof(name[0])); }