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

Multiplying CFrame doesn't really multiply?

Asked by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

If I were to do

workspace.Part.CFrame = workspace.Part.CFrame * CFrame.new(0,0.5,0)

It would cause the brick to raise half a stud. But that does not make sense, because I'm multiplying. What really should happen is the x and z should both move to 0, (since multiplying any number by 0 equals 0). Then, the y should be equal to the original CFrame divided by 2 (since it was multiplied by 0.5)

Therefore it seems to me that * behaves the exact same way as + would. I don't understand this.

0
CFrames are matrices; this is *matrix multiplication*, which is a real math thing, and acts like this (which is not intuitive but is very useful). BlueTaslem 18071 — 10y

1 answer

Log in to vote
-1
Answered by 10 years ago

When you are "Multiplying" its actually adding

Before I explain: Why Workspace.Parent 0-o I don't think you can get the CFrame of the game -.-

Say you do workspace.Part.CFrame = workspace.Part.CFrame * CFrame.new(0,0,3) that will make the part go back 3 studs depending on what rotation or direction its at but if you do

Workspace.Part.CFrame = Workspace.Part.CFrame + Vector3.new(0,0,3) that will add to the CFrame's position 3 studs in Z axis and not care for the rotation and position its at

Note: If you multiply CFrame then you can out put a Negative in the x or y or z axis for it to go forward instead of backwards.

1
This is matrix multiplication. You are not adding; you are multiplying matrices http://en.wikipedia.org/wiki/Matrix_multiplication http://wiki.roblox.com/index.php/Transformation_matrix BlueTaslem 18071 — 10y
0
I meant workspace.Part, sorry. And thanks blue. Perci1 4988 — 10y
Ad

Answer this question