Mount the camera 3P model

Please lock, I’ve got it fixed.

I tried something like this once, drawing the world model and using Calcview to set the camera to inside his head. It looks horrible but it was just a test. Here’s the code, goes in autorun/client, modelunity 1/0 to toggle.

[lua]
ModelUnityCVar = CreateClientConVar(“modelunity”, 0, true, false);

local function MUDrawWorldModel()
if ModelUnityCVar:GetInt() == 1 then
return true
end
end

local function MUCalcView(ply, origin, angles, fov)
if ModelUnityCVar:GetInt() == 1 then
local myhead = LocalPlayer():LookupBone(“ValveBiped.Bip01_Spine4”);
local newview = {}
newview.origin = LocalPlayer():GetBonePosition(myhead)+LocalPlayer():EyeAngles():Forward()*10+Vector(0,0,20);
newview.angles = angles;
newview.fov = fov;
newview.drawviewmodel = false;
return newview;
end
end

hook.Add(“ShouldDrawLocalPlayer”, “MUDrawWorldModel”, MUDrawWorldModel);
hook.Add(“CalcView”, “MUCalcView”, MUCalcView);
[/lua]

Hmmm
I tried this code, and kept modifying it, since it seems that the model rotates with your camera rotation. I looked but i couldn’t actually find any command that does this.
Any ideas?
(If you didn’t understand, I mean that i need to find a way to stop the playermodel rotating up and down with the camera).

Sorry to bump, but I do kind of need this. D:

Looking at http://wiki.garrysmod.com/?title=Player.SetViewEntity It gives a clear example of how to set the view in to Birds Eye and should not be hard to make some third person out of this.

An option would be to use foreconvar to set the source engines third person

Hmm
Okay, I’ll try this. Thanks and welcome to FacePunch :slight_smile:

Sigh.
Ok, the SetEntityView is off the drawing board. All it does is place the camera behind the worldmodel. I don’t think it can find the specific head bone, just the player.
CalcView seems to be the way to go, but it has a number of bugs. For one, the model rotates fully with the camera. So when you look towards the ground, the model is face to face with it. Kind of annoying.
The other thing is that the model won’t stop vibrating, which can get extremely distracting, and sometimes has trouble rotating (it will move slowly, then suddenly jump).
Any ideas?

Oh come on! I seriously need this!

Erm…are you making a 3rd Person camera or a camera inside a head to show model below you?

A first person, but camera is inside the third person model’s head. So the position and rotation of the camera are decided by the position and rotation of the head.

Uh… Little help?


(User was banned for this post ("Bump bumpity bump" - mahalis))

The model’s head moves differently to the actual player, so you might need some heavy tweaking to get rid of that. Then theres the actually showing the model and stuff…


You can change the position of the head. I think that’s already done. I want the view to shake from side to side and whatnot.
My main problem is, the world model seems to rotate fully depending on your angle. So you’re face flat on the ground if you look directly at it.
Any ideas?

.

Sorry for the bump, but I’m restarting coding. Anyone have an idea?

EDIT

Okay scratch this, turned out the GMod update fixed it. Or something.

This works, please lock.