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

How do you check if there's enough room to spawn/or force spawn a brick?

Asked by 8 years ago

I'm spawning a brick/model in but if there happens to be something in the way of the spawn coordinates (using vector3) its will just spawn higher and higher until its out of the way of the obstruction. Is there a way to either:

  1. Check the spawn zone via script? or...

  2. Use a different method of spawning that will force the spawn whether another brick is clipping inside it or not.

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
8 years ago

Both options are plausible, and neither is even that difficult! We'll go with option 2 for now, since it's more common and even easier to use.

This method is CFrame. CFrame, or CoordinateFrame, will allow a Part to clip other objects. Another difference between this and Vector3 is that CFrame contains rotation, but you won't be using that in this situation.

There are many different CFrame constructors we can use to put together different combinations of position and rotation. For our purposes, two could suffice. Take a look;

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

--Or

workspace.Part.CFrame = CFrame.new( Vector3.new(0, 0, 0) )

Both of these will position the part to 0, 0, 0, but it will clip other objects.

0
This worked great. Especially the second example you gave with the vector3 thanks pdiddy20 20 — 8y
Ad

Answer this question