# A problem with angles and coords

## Recommended Posts

I am working on a first person mod and I need to point the camera at a point exactly 200 units away from the player's car. I am using basic trig.

`:Label950953 0001: wait  0 ms0054: store_player \$PLAYER_CHAR position_to \$XPOS \$YPOS \$ZME00AA: store_car \$TEMP position_to \$764 \$763 \$ZPOS0009: \$ZPOS += 1.002F9: unknown_car \$TEMP unknown_sinus \$XANGLE 02F8: unknown_car \$TEMP unknown_cosine \$YANGLE0174: \$ZANGLE = car \$TEMP z_angle0086: \$XPOS2 = \$XPOS0086: \$YPOS2 = \$YPOS // \$800 is the car's z angle as well, defined elsewhere in the script:Label95095F2 0086: \$ANGLE = \$800 02F6: \$802 = sine \$8000011: \$802 *= 200 // 200 is the hypotenuse0086: \$XAXIS = \$802  02F7: \$803 = cosine \$8000011: \$803 *= 200 0086: \$YAXIS = \$8030059: \$XPOS += \$XAXIS // Add the x value to your current position0059: \$YPOS += \$YAXIS // Add the y value to your current position015F: set_camera_position \$XPOS2 \$YPOS2 \$ZPOS \$XANGLE \$YANGLE \$ZANGLE // Current x/y/z position and rotations- put it there0160: point_camera \$XPOS \$YPOS \$ZPOS 2 //point it at the points defined 3/2 above0002: jump @Label950954`

When the script is activated, the camera just points east (90 degrees) and does not rotate when the car does (it moves N/S/E/W though, without turning, like moving a tripod but not turning it). It appears this is the default for cameras, as when the camera is not pointing anywhere it points east. I would really like to find out a way to make this work right.

Did I mess up my sine and cosine or is it something else?

EDIT: I can use GTA III opcodes only, and this is SCM not CLEO.

Edited by fireguy109

##### Share on other sites

Well, according to GTAG, you've got 02F9 and 02F8 mixed up.

##### Share on other sites

But all that does is get the x and y angles for the camera, so if the car flips the camera flips too, etc.

Fixed that but the problem still appears.

##### Share on other sites

Try converting the angles to radians.

##### Share on other sites

Nope, didn't work.

EDIT:

`0160: point_camera \$XPOS \$YPOS \$ZPOS 2`

I'm playing around with different values for where 2 is, in the hopes of finding a solution. Using this as a guide-

http://www.gtaforums.com/index.php?showtop...0entry3915346

No luck so far with anything other than 1/2, and those don't fix it.

Edited by fireguy109

Check this

##### Share on other sites

Check this

I was hoping to make my own.

I guess I'll just open it up and see how they did it.

##### Share on other sites

Just wanted to show that there is an another way to do it.

## Create an account

Register a new account

×