General > Developers Corner

eye look pos

(1/3) > >>

Bite That Apple:
Is there a way to make a player look at a position, I need an example if so, because garry's wiki is terrible and gives terrible examples.

Bytewave:
Well there's always code you could mess around with in here:
https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexaa2f.html

JamminR:
http://wiki.garrysmod.com/page/GM/CalcView
Seems to have a decent example.
There's also EyeAngles(), and we use GetPos() in combination with it for some of our teleport commands.
I didn't look close, but presume when we get the EyeAngles and assign it to a player, then GetPos, then later SetPos that same player, is how we teleport and still have the player facing the same direction.

Bite That Apple:

--- Quote from: JamminR on February 07, 2015, 04:15:13 PM ---http://wiki.garrysmod.com/page/GM/CalcView
Seems to have a decent example.
There's also EyeAngles(), and we use GetPos() in combination with it for some of our teleport commands.
I didn't look close, but presume when we get the EyeAngles and assign it to a player, then GetPos, then later SetPos that same player, is how we teleport and still have the player facing the same direction.

--- End quote ---

Yeah, I looked through the teleport.lua and I commented things out to see if you were right, and well you weren't (unless I had misunderstood something you said). All !teleport does from what I saw is it takes the looking position, and just sends them there, thus never having to actually having to touch the looking position.

Basically I'm doing this for my addon "Set Spawn Points" -> http://forums.ulyssesmod.net/index.php/topic,8111.0.html

I'm trying to make it so that the player can continue the same direction as he was looking when he created the spawn point. Though, sadly, garry doesn't support straight forward answers, and likes everything really complicated.

JamminR:
Now that you mention it, you're right.
Seen this though, right?
http://wiki.garrysmod.com/page/Player/SetEyeAngles
Shouldn't be hard to figure out... you set a vector and your player looks at it.

Navigation

[0] Message Index

[#] Next page

Go to full version