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: What exactly is lookVector?

Previous Thread :: Next Thread 
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
22 Jul 2014 08:29 PM
When I type into output
print(game.Workspace.sayhisam1.Torso.CFrame.lookVector)
I get something like
-0.966105103, 2.82760565e-022, -0.258149564
What exactly does this number mean?
Is it representing a value?
Is it in radians, degrees, or neither?
I am so confused..
Report Abuse
VisualGraphics is not online. VisualGraphics
Joined: 26 Nov 2010
Total Posts: 6515
22 Jul 2014 08:33 PM
http://www.roblox.com/Forum/ShowPost.aspx?PostID=39610971

some great explanations there
Report Abuse
Seizurezxzz is not online. Seizurezxzz
Joined: 12 Feb 2013
Total Posts: 1297
22 Jul 2014 08:33 PM
Alright well:
Look vector is the way the "Front" is facing, all parts have a front just look in the surface tab to see which side is the front.
And that would print whitch exact way, according to Vector3 your torso is looking.
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
22 Jul 2014 08:38 PM
I don't really quite understand the concept of direction unit vector.
Could someone explain this to me?
Like, if my lookVector was (1,1,1), what would my player look like?
Report Abuse
Seizurezxzz is not online. Seizurezxzz
Joined: 12 Feb 2013
Total Posts: 1297
22 Jul 2014 08:40 PM
You would have multiple "Front" surfaces (I think)
Since LookVector measures in scales from 0-1

But,
(LookVectorX, LookVectorY, LookVectorZ) -- Maybe Y and Z might be switched, but I think Lua put then in alpha order.
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
22 Jul 2014 08:42 PM
I know that it measures from 0-1, but how would you be able to use this information?
What "direction" is (0,0,0) lookVector representing?
Would your block in question be facing up?
Down?
Report Abuse
Seizurezxzz is not online. Seizurezxzz
Joined: 12 Feb 2013
Total Posts: 1297
22 Jul 2014 08:44 PM
LookVector 0,1,0 Is facing up
LookVector 0,-1,0 Is facing down
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
22 Jul 2014 08:45 PM
Ah, thank you, that really clears up a lot.
so 180* lookVector would get you the lookVector in degrees? Assuming that 0 is facing straight forwards, and -180 is down, and 180 is up.
Report Abuse
Seizurezxzz is not online. Seizurezxzz
Joined: 12 Feb 2013
Total Posts: 1297
22 Jul 2014 08:50 PM
Yes, but that would scale 180 down to the 0-1 scale for you; So it would work.
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
22 Jul 2014 08:51 PM
so then if you were to turn a part upside down, so that it would be facing behind where it was, but upside down, what would the lookVector be then?
Report Abuse
Seizurezxzz is not online. Seizurezxzz
Joined: 12 Feb 2013
Total Posts: 1297
22 Jul 2014 08:53 PM
Just it's negative counterpart.
part = script.Parent
function reverse()
wait(1)
part.LookVector = (0, 1, 0)
wait(1)
part.LookVector = (0, -1, 0)
end

This function just reverses it's LookVector over the Y axis.
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
22 Jul 2014 08:58 PM
Pretty sure lookVector is read-only.
And is located in CFrame of a part...

On a side note, what is the rotation of a part, then?
Can you convert between lookVector and rotation?
Report Abuse
Seizurezxzz is not online. Seizurezxzz
Joined: 12 Feb 2013
Total Posts: 1297
22 Jul 2014 09:00 PM
It's not read only,
you can do stuff like
Part.Position = NewPart.CFrame.LookVector * CFrame.new(2, 0, 0)
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
22 Jul 2014 09:40 PM
The "lookVector" is the "forward vector" of the 3 vectors that make up the rotation part of the CFrame. (Well, actually it is the negative back vector, but yeah)

Here is how the rotation part of a CFrame works:

UpX, RightX, BackX
UpY, RightY, BackY
UpZ, RightZ, BackZ

Where Up, Right and Back are 3 perpendicular unit vectors which represent the 3 facing directions of the matrix.
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
23 Jul 2014 12:08 PM
Ah, so the rotation part of the CFrame are the quaternions, right?
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