Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I get the stupid position of Surfaces?

Asked by 4 years ago

So YOU KNOW HOW THERES SURFACES IN A PART

FRONT SURFACE,... ETC

I WANT TO GET THE POSITION OF THEM

1 answer

Log in to vote
0
Answered by
Farsalis 369 Moderation Voter
4 years ago

You can get the surfaces of a part from CFrame. Here's an example: Also, before you read this, make sure you know that, the first 3 parts of a CFrame (x,y,z), are Position vectors, where as you will see, adding to these are nine other numbers (Which Are Also Vectors), representing rotation.

local x,y,z, rot_x_x, rot_x_y, rot_x_z, rot_y_x, rot_y_y, rot_y_z, rot_z_x, rot_z_y, rot_z_z = CFrame:components()
    local Matrix = {
        -x = Vector3.new(rot_x_x, rot_x_y, rot_x_z);
        -y = Vector3.new(rot_y_x, rot_y_y, rot_y_z);
        -z = Vector3.new(rot_z_x, rot_z_y, rot_z_z);
    }
--[[In This Case, For Surfaces.
    x,y,z are our regular coordinates. aka.(Right, Bottom, Back)
    Now, how do we get the other surfaces? Pretty Easy, we can just get the Unary of each of these vector. e.g(-x, -y, -z), aka.(Left, Top, Front). You also, may of heard of -z before...its other name is lookVector, aka.(The field of the CFrame).]]

Note* The Code Example Used Is From joboro13.

Now, I didn't go into very much detail at all, but joboro13 definitely does. Check Out His First CFrame Article, where you can also take a look at the code I used as well. https://scriptinghelpers.org/guides/the-power-of-cframes After reading the first article, you should definitely read the sequel to it. https://scriptinghelpers.org/guides/exploring-the-cframe-api

Hope This Helped, and sorry if this isn't very clear, though reading the articles will help put the pieces together.

Ad

Answer this question