• Free look in third person.
    1 replies, posted
I made my own custom third person and I'm trying to figure out how to free look when you press a certain button. thirdperson_platformer 1 resembles almost exactly what I want except I want to bind it to a certain key and I don't want to go through it since I'd have to use the default thirdperson. Any tips?
This is a bit tricky, but it's doable. I'm going to assume you already have a plan for capturing player input and making a function that will turn free-look on and off. When the player starts freelooking, save their current EyeAngles() to two variables somehow, like lastEyeAngles and freeLookAngles or something along those lines. Then You'll have to use the hook GM/CreateMove which will give you a CUserCMD object. in the hook. check to see if the player is free-looking. set the cmd object's view angles to lasteEyeAngles using CUserCmd/SetViewAngles to lock the player's normal viewing angle, then use CUserCmd/GetMouseX and CUserCmd/GetMouseY to get the X and Y movement of the mouse and use it to modify your freeLookAngles. After that, assuming you're using CalcView for the third person, adjust the angle of the camera to take the freeLookAngles into account, I recommend looking into LocalToWorld to set the offset of the camera from the player's normal eyepos/eyeang, and util.TraceHull to keep the camera from going through walls. I know this is all seems kind of weird or hacky and there aren't really any usable examples of this out there, but I don't think there's really any other way, so try out what I've said above and if you can't get it working, post your code and I'll see if I can give you an example.
Sorry, you need to Log In to post a reply to this thread.