So i'm trying to make it were my camera locks to set pos but i can't seem to get it worked.
Like the camera can only move between these two pos.
[CODE]function lookup()
local ply = LocalPlayer() //-3.178 1.564 0.000, 22.892 2.920 0.000
local vec1 = Vector(-3.178 1.564 0.000)
local vec2 = Vector(22.892 2.920 0.000)
ply:SetEyeAngles((vec1 - vec2):Angle())
end[/CODE]
If you want Lua help you should be in the development section.
What exactly are you trying to do? There may be an easier way.
Well what i trying to do is kind have a 3rd person mode but then have the cam only be able to move between two set of pos.
This may be complex, and I don't know exactly how to do it, but this info should be useful.
You are going to need to change the camera view point, which is done with [URL="http://wiki.garrysmod.com/page/GM/CalcView"]CalcView[/URL].
You are going to need a way to toggle between views ([URL="http://wiki.garrysmod.com/page/Global/CreateClientConVar"]cvar[/URL], [url]http://wiki.garrysmod.com/page/concommand/Add[/url] or [URL="http://wiki.garrysmod.com/page/GM/KeyPress"]keybinding[/URL]).
You need to specify the two positions you want (I am assuming you want one over left shoulder and one over right.). The example on the wiki shows you can move the view backwards, you can also move it right or left with [URL="http://wiki.garrysmod.com/page/Angle/Right"]Angle:Right()[/URL] or Angle:Right()*-1 respectively.
Umm thats not really what i need but thanks for the help. What i want is a camera in third person witch i already have. Now i want the camera to be above the player model which i already done with the calcview. Now that i have the camera above the player model i want to lock the camera so you cant look 100% up or 100% down so its like you can look 75% way up and down but not 100%
[QUOTE=fondoodle;47089339]Umm thats not really what i need but thanks for the help. What i want is a camera in third person witch i already have. Now i want the camera to be above the player model which i already done with the calcview. Now that i have the camera above the player model i want to lock the camera so you cant look 100% up or 100% down so its like you can look 75% way up and down but not 100%[/QUOTE]
You can simply clamp the pitch and create a new angle.
[code]Pitch = math.Clamp(Pitch, -80,80)[/code]
I think pitch only goes from -90,90?
EDIT: goes from 89 (~straight down) to -89 (~straight up)
Turns out when you lock angle, the view position rotates around the player in a spherical fashion.
Okay I figured out an easy way to do it! [URL="http://wiki.garrysmod.com/page/GM/CreateMove"]CreateMove[/URL]
[code]
function MyCreateMove( cmd )
local angles = cmd:GetViewAngles()
local newAng = Angle( math.Clamp(angles.p,-10,10), angles.y, angles.r)
cmd:SetViewAngles(newAng)
end
hook.Add("CreateMove", "MyCreateMove", MyCreateMove)
[/code]
Yes thanks you this is what i need. I didn't even think about looking up createmove. Thank you alot.
Sorry, you need to Log In to post a reply to this thread.