EgoMoose placing system question

hi anyone familiar with egomooses placing system? or atleast is capable of explaining whatever he is doing in this :

function Placement:CalcCanvas()
	local canvasSize = self.CanvasPart.Size

	-- want to create CFrame such that cf.lookVector == self.CanvasPart.CFrame.upVector
	-- do this by using object space and build the CFrame
	local back = Vector3.new(0, -1, 0)
	local top = Vector3.new(0, 0, -1)
	local right = Vector3.new(-1, 0, 0)

	-- convert to world space
	local cf = self.CanvasPart.CFrame * CFrame.fromMatrix(-back*canvasSize/2, right, top, back)
	-- use object space vectors to find the width and height
	local size = Vector2.new((canvasSize * right).magnitude, (canvasSize * top).magnitude)

	return cf, size
end

why would he convert it to object space first? why not just use it all in world space, also how did he rotate the cframe back into worldspace?

If you want a detailed explanation, drop your discord here and I’ll provide a very detailed explanation. It’s too long to put all here at once.

Why would you defer to private messages for this? Fleshing out the explanation here will ostensibly help anyone searching for this topic in the future. What do you mean with this statement:

It’s too long to put all here at once.

If anything, Discord is less made for explanations like this. Do you mean that the format is less like text messaging here and perhaps more formal?

6 Likes

It was a text conversation between me and a friend that goes into many different and irrelevant questions, but it was too long to paste each segment of the relevant conversation here.

Im having trouble understanding this too, can you also help me? discord: Xbscure#9390

Not a helpful answer. This is a problem I’ve noticed for a while now, being that there is a kind of brain drain from public places like the DevForum to walled-off direct messages between users. While the OP may get the help they need, it is very frustrating for anyone searching this topic in the future to stumble upon a thread with the exact same issue only for the answers to be inaccessible. Because of this, answering the many questions asked here becomes the job of a few noble-minded power users, as is currently the case unfortunately.

My plea to anyone reading is that if you choose to use direct messages to have your questions answered, post the conversation as its own locked thread on the bulletin board or, if it’s a thread like this, then in there. If there’s private details as part of the conversation that you don’t wish to disclose, at least extract the answer and post it publicly as the solution.

Again, not sure what you mean by this:

it was too long to paste each segment of the relevant conversation here.

You have a lot of space here, so that can’t be the problem. What’s wrong with pasting all the relevant information that you can?

I remember talking to him and asking what .fromMatrix was, I forgot what it was rip… What I do know right now is that he is probably getting the extents of the base

1 Like

Imagine your character is lying flat in the center of the canvas, facing up. What your torso’s CFrame would be is basically what this calculates.

The CFrame.fromMatrix(…) creates a CFrame at the origin, facing towards the sky. It ignores the position and orientation of the canvas for now. This is “object space” because it assumes the canvas is at 0,0,0 and unrotated.

That’s multiplied by the canvas CFrame to move it to the actual canvas spot. This is “world space” because it’s a real location in the world.

Edit: I’m sorry, didn’t realize this thread was so old. I dunno how it showed up in my feed!

1 Like