• Freeze player but not camera
    9 replies, posted
Hi, What would the best way to make it so a player cant move but you can still rotate the camera around the player be? Lock and Freeze make it so you cant move the camera. Edit: I am using (In calcview) [code] view.origin = view.origin-(angles:Forward()*100); view.angles = view.angles; view.fov = fov; return view;[/code] And ShouldDrawLocalPlayer() to view the player in third person.
Set their speed to 0?
Player still moves to face away from the camera if you do that.
ply:SetMoveType( MOVETYPE_NONE )
[QUOTE=twoski;38239229]ply:SetMoveType( MOVETYPE_NONE )[/QUOTE] Brilliant. That stopped the movement. Any way to stop the player rotating as i move the mouse? So i can look at the front of him.
Not sure i get what you're asking. You want them to be unable to change their camera yaw? [lua] local ang = view.angles ang.y = 0 // freeze their yaw to 0 degrees view.origin = view.origin view.angles = ang view.fov = fov[/lua]
I mean, if you stand still and move the mouse the player rotates aswell so it is always facing with its back to you (Looking at it in 3rd person makes this easier to understand). What i want to be able to do is to move the mouse so it looks around the whole character and allows you to look at its front.
Oh, like 3rd person. You have to move the camera origin then make it face the player. [lua]local pos = LocalPlayer():GetPos() + EyeAngles():Forward() * 200 // move the camera forward based on eye angles local ang = ( pos - view.origin ):GetNormal():Angle() // point at the player view.origin = pos view.angles = ang view.fov = fov[/lua]
That code dosent quite seem to work. End up staring at the ground, not being able to move the camera and i think its upside down aswell. [editline]30th October 2012[/editline] Ok i have managed to make it face the player. However the main problem i am having is the player model rotates as the mouse moves around. Can i make it so the player model stays facing the same direction?
I dunno, you need to learn vector and angle maths if you want to do anything like this. If you want to be able to move the camera but keep the player facing one direction then you'll have to do some messing with input and camera angles.
Sorry, you need to Log In to post a reply to this thread.