How to think about CFrames

This is honestly the most useful resource I have ever seen on this forum. You sir, are amazing :smiley:

Would you like for me to do one on Vectors, stuff like dot and cross product?

5 Likes

Would you like for me to do one on Vectors, stuff like dot and cross product?[/quote]

I would love an article on dot and cross product, with examples of applicable usage for each one.

Would you like for me to do one on Vectors, stuff like dot and cross product?[/quote]

I would love an article on dot and cross product, with examples of applicable usage for each one.[/quote]

The first one, I can do. The second part about applicable usage, I don’t really know.
There’s only one use for cross and dot product, kind of like there’s only one use for multiplication or one use for subtraction. You use multiplication when you need to multiply two numbers together, and you use subtraction when you need to find the difference between two numbers.

You use cross product when you need to find a vector perpendicular to two vectors with a magnitude equal to the area of the parallelogram defined by said two vectors. That’s all of the usage you get out of it.

1 Like

Would you like for me to do one on Vectors, stuff like dot and cross product?[/quote]

I would love an article on dot and cross product, with examples of applicable usage for each one.[/quote]

The first one, I can do. The second part about applicable usage, I don’t really know.
There’s only one use for cross and dot product, kind of like there’s only one use for multiplication or one use for subtraction. You use multiplication when you need to multiply two numbers together, and you use subtraction when you need to find the difference between two numbers.

You use cross product when you need to find a vector perpendicular to two vectors with a magnitude equal to the area of the parallelogram defined by said two vectors. That’s all of the usage you get out of it.[/quote]

Well, that’s pretty general. What I’m looking for are specific use cases, such as when would you need to find a vector perpendicular to two vectors with a magnitude equal to the area of the parallelogram defined by the two vectors? What are some things you could do that involve the usage of the cross and/or dot products of vectors?

Edit:

Like how the Pythagorean theorem is useful for finding the distance between two points by creating a right triangle and finding the hypotenuse. With that information you can, for example, find the distance of a rocket from where it fired. This information has many uses that can determine the fate of the rocket and those near it.

That’s essentially what I meant by applicable usages.

Would you like for me to do one on Vectors, stuff like dot and cross product?[/quote]

I would love an article on dot and cross product, with examples of applicable usage for each one.[/quote]

The first one, I can do. The second part about applicable usage, I don’t really know.
There’s only one use for cross and dot product, kind of like there’s only one use for multiplication or one use for subtraction. You use multiplication when you need to multiply two numbers together, and you use subtraction when you need to find the difference between two numbers.

You use cross product when you need to find a vector perpendicular to two vectors with a magnitude equal to the area of the parallelogram defined by said two vectors. That’s all of the usage you get out of it.[/quote]

Well, that’s pretty general. What I’m looking for are specific use cases, such as when would you need to find a vector perpendicular to two vectors with a magnitude equal to the area of the parallelogram defined by the two vectors? What are some things you could do that involve the usage of the cross and/or dot products of vectors?

Edit:

Like how the Pythagorean theorem is useful for finding the distance between two points by creating a right triangle and finding the hypotenuse. With that information you can, for example, find the distance of a rocket from where it fired. This information has many uses that can determine the fate of the rocket and those near it.

That’s essentially what I meant by applicable usages.[/quote]

Huh. I don’t know. You know, I don’t really have a list of formulas I keep. Every time I do something, I come up with the solution again from scratch. Because of this, when I think about math, all I see are a few basic formulas, and all math is very simple as a result of that.

I don’t even really know the Pythagorean theorem. I just remember that dot product returns a scalar and is multiplication, so if you dot a vector with itself, you get the scalar, vector^2, if you just take the square root of that, you get the scalar of the vector, which has to logically be magnitude.

In my opinion, this very basic understanding of everything is what allows me to do what I do as well as I do it. The purpose of putting up this article was not to tell people how to use CFrame, it was to give them to knowledge to be able to freely create new ways of doing things and to solve problems that they wouldn’t have previously been able to. But I do now understand that it would be good to give a bit of context, I might do so in this article, and definitely will in the dot and cross product article. Thank you for convincing me to.

HOWEVER, the examples will take up the majority of the article.

Should really put this on wiki.

(And I wouldn’t mind putting it up there, but putting it up there without credits, which I think is forbidden…)

1 Like

Could you explain why the z direction is pointing to back, not front? There is right direction, top direction and then one to the back, seems strange to me.

1 Like

If every wiki article was like this do you know how smart I would be, and how much better at coding I would be? I’ve been pondering this for YEARS and in the first few damn lines he’s explained it to me… Literally, not exaggerating, for years…

w1k1 pl0x?

2 Likes

If I could build ROBLOX from scratch, I would rewrite the components function to return the matrix in inverse order so that you could get it in a way that makes sense.

--How I would do it:
Px,Py,Pz,   Xx,Xy,Xz,   Yx,Yy,Yz,   Zx,Zy,Zz   =   SomeCFrame:components()

Also, if I were to define the z axis as the forward and backward axis, I would use left hand rule instead of right hand rule, such that z would get more positive as you go forward. This, by the way, would also make Euler angles make a little more sense (The x angle would no longer be negative).

If I could edit ROBLOX code, I would add functions to CFrame such that when you said:

SomeCFrame.Right
SomeCFrame.Top
SomeCFrame.Back

it would return you Vector3s of the CFrame’s directions.

I would also add better support for axis angle rotations and quaternions. I would also have an interpolate function for CFrames.

There’s a lot of stuff I would do differently that I feel would make more sense.

Always been annoyed by eulerangles, that I atleast had a little understanding of, that and the inversed Z axis.

I don’t understand CFrames at all, so here’s my feedback to your post.

You didn’t explain what a vector is. Something with both magnitude and direction? Maybe show examples of 2-dimensional vectors and 3-dimensional vectors in ROBLOX (e.g. Vector2.new(x, y), Vector3.new(x, y, z)).

[quote]A CFrame actually contains three more of these lookVectors, except instead of pointing in the forward direction, they point to the right, top and back of the CFrame
It’s confusing to say CFrames have 3 more lookVectors when they aren’t called lookVectors. Why is the positional vector called lookVector anyway?[/quote]
I still don’t understand, given the right, top, and back vectors, how can you “visualize” which direction a CFrame is pointing in. Perhaps show a diagram with an example CFrame and how the three directional vectors determine the rotation?

As for your vector mishap, have you never set the position of a part before? This definitely does not fit in the CFrame post I made, (which is for people who already understand how to use CFrame a little, but not completely, and don’t understand how it works), so I’ll tell you directly.

A vector is a number. Just as numbers can be used to represent all kinds of things, so too can vectors.
a vector contains any amount of numbers. A 3D vector, known as Vector3 in ROBLOX, contains 3 numbers. A 2D vector contains 2 numbers.

We live in a 3D world, and ROBLOX is a 3D game world. This means that you can move to the left and right, up and down, and forward and backward, which are three directions (3 dimensions). We can use 3D vectors to represent positions, as well as directions in 3D space.

When it comes to vector positions, I draw those as points (see the point, Position Vector, in the drawing above), and I draw directions as arrows (see Right, Top and Back Vectors in drawing above).

Directions are generally represented as unit vectors. A unit vector is a vector with a length of one. For example, the vector, <1,0,0> has a length of 1 because if you were to take a ruler and measure from <0,0,0> to <1,0,0>, the length on the ruler would say 1.

Uh, that’s all, really. What do you do if you don’t build or code, though?

1 Like

The pictures all loaded, but I wasn’t able to make sense of them, knowing nothing of CFrames.

2 Likes

I just put a tremendous amount (a full hour) of effort into trying to come up with the perfect way to explain vectors from the ground up, and you don’t even recognize me for it. If you want to learn CFrames, or really do anything, you can’t laze around and ask people to give you answers to everything. You need to take an active stance in your learning.

Also, keep in mind

1 Like

I appreciate that you made this guide to understanding CFrames. I understand that it’s not targeted at users who have no experience with CFrames, but I am one of those users. I tried to ask you specific questions about what I don’t understand so you could clarify.

Edit: I just noticed you posted some new content in reply to my previous message. I thought you had just posted a quote of the original post. Thanks!

1 Like

“A vector is a number.”

But, but, but… My physics teacher said a vector is a number with a direction, a scalar is just a number.

1 Like

[quote] “A vector is a number.”

But, but, but… My physics teacher said a vector is a number with a direction, a scalar is just a number. [/quote]

I’m pretty sure he said direction and length, as length isn’t really accessable, til you calculate it.

And unlike scalar, vector is several numbers, nothing more.

1 Like

[quote] “A vector is a number.”

But, but, but… My physics teacher said a vector is a number with a direction, a scalar is just a number. [/quote]

A vector is a number that represents a direction.

Vector3 is 3 numbers that represent a direction.

2 Likes

[quote] “A vector is a number.”

But, but, but… My physics teacher said a vector is a number with a direction, a scalar is just a number. [/quote]

A vector is a number that represents a direction.

Vector3 is 3 numbers that represent a direction.[/quote]

A 3D vector is a number that is composed with three elements. Kind of how a quaternion is a single number that represents an orientation.

1 Like