n_cy
(n_cy)
August 11, 2020, 6:30pm
#1
I’m trying to make a placement system and I’m having trouble understanding what frommatrix is
local back = Vector3.new(0, -1, 0)
local top = Vector3.new(0, 0, -1)
local right = Vector3.new(-1, 0, 0)
local cf = self.CanvasPart.CFrame * CFrame.fromMatrix(-back*canvasSize/2, right, top, back) -- What does from matrix even do? I read on the wiki it creates a cframe???
local size = Vector2.new((canvasSize * right).magnitude, (canvasSize * top).magnitude)
The code is from here
This guide was originally written for scriptinghelpers . The original can be found here .
One of the most common requests I get for blog post topics are for a decoration placement system that saves. I’ve shied away from this topic in the past as there is no singular “correct” way to do it. That being said, I think it’s a good exercise for all game devs to go through and will potentially place a role in a future blog post I plan to write.
In addition to change things up, I’ll also take the ti…
Embedded77
(Embedded77)
August 11, 2020, 6:48pm
#2
theres already a post for it
The title says it all. What is that? How can I use it for an object rotation. I really have no idea. An example please?
2 Likes
CFrame.fromMatrix is a different way of using CFrame.new(position, lookVector)
It does this: CFrame.fromMatrix(position, vectorX, vectorY, vectorZ)
Vector X would be the position the X axis of the part will look at.
Vector Y and Vector Z does the same.
So basically if you already have a “notion” of vector3 then this would be easy to understand:
CFrame.fromMatrix(Vector3 pos, Vector3 vX, Vector3 vY , Vector3 vZ)
pos: Position the part will be at.
vX = Where the part’s X axis will be looking at.
vY = Where the part’s Y axis will be looking at.
vZ = Where the part’s Z axis will be looking at.
3 Likes
nicemike40
(nicemike40)
August 11, 2020, 7:11pm
#4
You may want to read this , and then read this .