Realistic First Person View

Hi I was wondering if anyone can re-create the “cam_attacheyes” console command found in Smod. This makes your thirdperson camera lock onto your playermodel’s eyes, so I thought it would be pretty cool if someone could make it via lua script.

Here is an example in Smod: Tactical 5.56:

http://img364.imageshack.us/img364/5783/d2coast030014.jpg

Yes, I know there’s a legs addon for gmod, but that’s just a simple viewmodel. I just was wondering if anyone can recreate the smod command into Garry’s Mod.

l4d has this.

The viewmodels in L4D aren’t just the thirdperson view.

nope
V_Model + Special legs model

Cmon guys none of you can make this script? Because I don’t have a clue on how to do it myself.

Locking the view to the eyes, then making it thirdperson doesn’t seem hard.
I’ll look into it, but then again, you could just look in the Gmod Wiki and find out how to do it

Yeah, I tried my best to learn how, I didn’t understand it very well.

I remember when I was browsing the l4d models in gmod, when I got to the view models, It was just the survivors with no heads.
So, If you (in clientside) deflate the player’s head, and put a camera there, this is what we want.

кто может создать мод с видом из глаз как в Zeno Clash?

<Who can create a mod with firstperson view like in Zeno Clash?>

This would get really annoying, plus it’d look like crap most of the time…
The third person models in GMod are horrible, and are extremely buggy in multiplayer.
I’d stick with the legs and the headbob…script…thing.

[lua]
AddCSLuaFile(“autorun/cam_eyeattachment.lua”)

if CLIENT then
CreateClientConVar(“cam_eyeattachment_fov”, 90)
hook.Add(“CalcView”, “cam_eyeattachment”,
function(Player, Position, Angles, FOV)
if Player:GetNWInt(“Cam_EyeAttachmentToggle”) < 1 then return end
Player:DrawModel()
local Angles = Player:GetAimVector():Normalize():Angle()
local Position = Player:GetAttachment(Player:LookupAttachment(“eyes”)).Pos

	FOV = GetConVar("cam_eyeattachment_fov"):GetFloat()
	
	return GAMEMODE:CalcView(Player, Position, Angles, FOV)
end)

end

if SERVER then

function CamEyeAttachment(Player)
	if Player:GetNetworkedInt("Cam_EyeAttachmentToggle") == 1 then
		CamEyeAttachmentDisable(Player)
	else
		CamEyeAttachmentEnable(Player)
	end		
end

concommand.Add("cam_attacheyes", CamEyeAttachment)

function CamEyeAttachmentEnable(Player)
	if Player:GetNetworkedInt("Cam_EyeAttachmentToggle") == 1 then return end
	local Entity = ents.Create("prop_dynamic")
	Entity:SetModel("models/props_lab/huladoll.mdl")
	Entity:Spawn()
	Entity:DrawShadow(false)
	Entity:SetMoveType(MOVETYPE_NONE)
	Entity:SetNotSolid(true)
	Entity:SetPos(Player:GetPos())
	Entity:SetParent(Player)
	Entity:SetColor(0,0,0,0)
	
	Player:SetViewEntity(Entity)
	Player:SetNetworkedInt("Cam_EyeAttachmentToggle", 1)	
end



function CamEyeAttachmentDisable(Player)
	if Player:GetNetworkedInt("Cam_EyeAttachmentToggle") == 0 then return end
	local Entity = Player:GetViewEntity()
	Player:SetNetworkedInt("Cam_EyeAttachmentToggle", 0)
	Player:SetViewEntity(Player)
	Entity:Remove()
end	

end
[/lua]

Looks like crap, but oh well.

goes in autorun/cam_eyeattachment.lua

filename is important

http://errur.com/i/images/9929_wireconstruct_sounds0024.jpg

HOLY SHIT! Great job

will it be downloadable…?

uhh no not at all :downs:

Woah.
Awesome!

Don’t forget to add the head bobbing on the speed you are going.

Now if someone could make it so you only see half of your own playermodel, wow.

It’s been done…

That spawns a model under you. If you go into third person, you’d see it under you. I’m saying using this, and the weapon nor the upper half of your body shows, client side.

Errr…that’s basically what the legs do, except it just spawns a new model like you said. And you can’t see them in third person, they’re automatically hidden when you go into a camera view or third person vehicle view…