Player.SetViewEntity

From GMod Wiki

Revision as of 06:45, 29 August 2011 by GIG (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax Player:SetViewEntity( Entity )
Description:
Causes the player to see the world through the 'eyes' of the supplied entity.
Returns: nil
In Object: Player
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.SetViewEntity]Player.SetViewEntity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionBirds eye world view from 'The Gims' gamemode.
Used onNewerServer.png
Code
local cam = ents.Create("prop_physics")
 
cam:SetNWString("owner", ply:Nick())
cam:SetModel("models/props_c17/oildrum001.mdl")
cam:SetColor(255,255,255,0)
cam:SetPos(ply:GetPos())
cam:SetAngles(Angle(90,180,0))
cam:Spawn()
cam:Activate()
cam:SetMoveType(MOVETYPE_VPHYSICS)
cam:SetSolid(SOLID_NONE)
 
ply:SetViewEntity(cam)
constraint.Weld(cam, ply, 0, 0, 0, true)
ply:SnapEyeAngles(Angle(0,180,0))
ply:SetMoveType(MOVETYPE_NOCLIP)
OutputBirds Eye View!


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox