Posted By: GamerX
First person tilt problem. - 09/17/08 00:35
Ok so im making a first person shooter but i ran into a problem with the camera and the player tilting.
Here is the script for the camera and the player views:
Its basically just an arm with a gun that is visible.(in reality that's all there is)
The problem is that since that collision box/rotate point of
origin or what ever you want to call it is below the arm so
that it can detect collisions and i had to add z to the
camera so that the arm will be in my view when i tilt the arm
pears further away(longer/extended) from the camera and when
i tilt it up it pears closer(arm gets cut down).
I have fixed this by just moving the rotate point of origin right by the arm, but then it doesn't pick up collisions and it just goes right over things. I also tried to put the hole body in there but it doesn't help.
Any1 got any ideas?
Here is the script for the camera and the player views:
Code:
void make_player() { arm = me; while (1) { camera.x = arm.x; camera.y = arm.y; camera.z = arm.z + 18; camera.pan = arm.pan; camera.tilt = arm.tilt; arm.z = -320.500; if (key_w) c_move (arm, vector(7 * time_step, 0, 0), nullvector, GLIDE); if (key_s) c_move (my, vector(-5 * time_step, 0, 0), nullvector, NULL); arm.pan -= 8 * mouse_force.x * time_step; arm.tilt += 8 * mouse_force.y * time_step; arm.tilt = clamp (arm.tilt,-20, 10); if (mouse_left) {shoot_percentage = 0; gun_blowback();} wait (1); } }
Its basically just an arm with a gun that is visible.(in reality that's all there is)
The problem is that since that collision box/rotate point of
origin or what ever you want to call it is below the arm so
that it can detect collisions and i had to add z to the
camera so that the arm will be in my view when i tilt the arm
pears further away(longer/extended) from the camera and when
i tilt it up it pears closer(arm gets cut down).
I have fixed this by just moving the rotate point of origin right by the arm, but then it doesn't pick up collisions and it just goes right over things. I also tried to put the hole body in there but it doesn't help.
Any1 got any ideas?