When you operate Roblox Studio, there will be some terms and you need to understand. Why? It is important because if you know and understand about the terms, you will be able to use it correctly. Now, in this article, we are going to explain about CFrame Lookvector.
First, before we go further about CFrame Lookvector, do you know what is CFrame? Okay now, let’s find out the definition of this term. CFrame is short for Coordinate Frame and it is a data type which are able to be used to rotate and position 3D objects. A CFrame contains global X, Y, and Z coordinates and also rotation data for each axis as either an object property or a standalone unit. Also, CFrames contain functions which are helpful for working.
Now, you surely want to know about CFrame Lookvector especially about how to use it. If you want to use CFrame LookVector, you are able to put it simply. For your information, LookVector is a unit vector of the direction of a CFrame. You are able to get the LookVector by added .lookVector to the end of a CFrame value. Here is an example.
local LookVector1 = Brick.CFrame.lookVector
local LookVector3 = CFrameValue.Value.lookVector
You need to know that LookVector is very useful if you want to make a part face a specific direction or if you want to make an object travel in a specific direction. Let’s take an example that we are going to make a bullet travel.
If you want to make an effective gun, you will need to make the bullets that can come out of the gun travel in the direction that the gun is facing. To be able to do that, you have to set the velocity of the brick as the direction that the gun is facing. So, you have to use the LookVector.
Bullet.Velocity = Handle.CFrame.lookVector * 100
In the line above, you are able to see that it multiples the lookvector by 100. It is done to make the magnitude of the vector 100 which gives the bullet a speed of 100 in whatever direction the handle is facing. So, the code that you see above will make the Bullet travel in whatever direction that the handle is facing at about 100 studs per second.
For more information about LookVector, you are able to ask other Roblox player who also understand about how to use LookVector. You are able to ask people in a forum or group. There are some places that you are able to use to get information about LookVector. Those are developer.roblox.com, scriptinghelpers.org, devforum.roblox.com, stackoverflow and many more.
When you apply the script of CFrame, you will be in Roblox Studio. Roblox Studio is a program which is provided by Roblox to enables Roblox players to be able to make a game there. In that program, there are a lot of tools that you are able to use for making your own games. So, if you want to make a game, you are able to access Roblox Studio.