Posted By: Sleepy
Camera help anyone? - 03/07/14 20:22
I found this code online somewhere sometime in the past, It works great all but camera tilt. Can someone help please?
Code:
action players_code() // attach this action to your player model in all the levels { var movement_speed = 10; // movement speed VECTOR temp; set (my, INVISIBLE); // 1st person player player = my; // I'm the player // this section recreates the flashlight (if needed) if (got_flashlight == 1) // the flashlight was picked up in a previous level? { flashlight = ent_create("lantern.mdl", player.x, move_flashlight); // the recreate it! } // end of the section that recreates the flashlight (if needed) while (1) { my.pan -= 7 * mouse_force.x * time_step; player.tilt += 5 * mouse_force.y * time_step;// Added this line but doesn't work. camera.x = my.x; camera.y = my.y; camera.z = my.z + 50 + 1.1 * sin(my.skill44); // play with 50 and 1.1 camera.pan = my.pan; camera.tilt = player.tilt; //5 * mouse_force.y * time_step; vec_set (temp.x, my.x); // trace 10,000 quants below the player temp.z -= 10000; temp.z = -c_trace (my.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX) - 2; // play with 2 temp.x = movement_speed * (key_w - key_s) * time_step; temp.y = movement_speed * (key_a - key_d) * 0.6 * time_step; c_move (my, temp.x, nullvector, IGNORE_PASSABLE | GLIDE); wait (1); } }