generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How do you check where the player is facing?

Previous Thread :: Next Thread 
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
23 Aug 2014 09:16 AM
^
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Aug 2014 09:22 AM
Player.Character.Torso.CFrame.lookVector

This will point in the direction he is facing.
For example, if he was facing north, I think it would be Vector3.new(1,0,0)

And if he was facing north-east, I think it would be Vector3.new(0.5,0,0.5)

I'm not sure, I might be totally wrong about the whole concept.
Look up CFrames on the wiki and it will tell you what lookVector does, in case I am wrong.
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
23 Aug 2014 09:30 AM
Okay, would this work then?

game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector
Report Abuse
Waffloid is online. Waffloid
Joined: 14 Jul 2011
Total Posts: 1606
23 Aug 2014 09:42 AM
no.

~ I'm not crazy, the voices in my head said so! ~
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
23 Aug 2014 09:44 AM
then why don't you help me fix it instead of just saying "No."
Report Abuse
Waffloid is online. Waffloid
Joined: 14 Jul 2011
Total Posts: 1606
23 Aug 2014 09:47 AM
coz idk what u need.

also, lookvector is a vector3, and camerasubject is for a object value.

try this?

lookV = game.Players.LocalPlayer:WaitForChild('Torso').CFrame.LookVector
game.Workspace.CurrentCamera = CFrame.Angles(lookV.X,lookV.Y,lookV.Z)

~ I'm not crazy, the voices in my head said so! ~
Report Abuse
Waffloid is online. Waffloid
Joined: 14 Jul 2011
Total Posts: 1606
23 Aug 2014 09:47 AM
or possibly

lookV = game.Players.LocalPlayer:WaitForChild('Torso').CFrame.LookVector
game.Workspace.CurrentCamera = CFrame.Angles(lookV.X,lookV.Y,lookV.Z)+game.Workspace.CurrentCamera.CoordinateFrame.p

~ I'm not crazy, the voices in my head said so! ~
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
23 Aug 2014 09:53 AM
thanks
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
23 Aug 2014 10:05 AM
what I want is the camera to target where the player is facing, this doesn't seem to cut it
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
23 Aug 2014 10:14 AM
b
Report Abuse
Waffloid is online. Waffloid
Joined: 14 Jul 2011
Total Posts: 1606
23 Aug 2014 01:32 PM
Not sure what you mean, can you elaborate? May be able to help.

~ I'm not crazy, the voices in my head said so! ~
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
23 Aug 2014 02:33 PM
If you played/watched DayZ Standalone, you'll know the camera style is the player facing backwards at all times, while they face therever the mouse points using lookvector, only that it's evaluated on the X axis to make sure the player's feet won't lift off of the ground.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
23 Aug 2014 03:51 PM
cam.CoordinateFrame = CFrame.new(cam.CoordinateFrame.p, head.Position)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image