开发者

ROBLOX Cframe How do I do it?

How do I Cframe any type of 开发者_运维技巧brick on ROBLOX ![alt text][1]


Workspace.Brick.CFrame = CFrame.new(0, 0, 0)

That makes the Brick in Workspace have a CFrame of 0, 0, 0(Inside the base)

Workspace.Brick.CFrame = Workspace.Brick.CFrame * CFrame.Angles(0, 0, 0)

That makes the Brick in Workspace have a tilt. Use math.pi*x where for each x = 1 tilts the brick in that direction 1 radian.


Use the CFrame library and object members in order to control the CFrame value. For example:

CFrame.new()

Will create a new CFrame whose matrix is set to the identity matrix. You can set a position to a CFrame by passing in 3 raw X, Y, Z values, or a Vector3 value.

CFrame.new(Vector3.new(0, 5, 0) == CFrame.new(0, 5, 0)

There is also the ability to rotate towards a vector.

CFrame.new(Vector3.new(0, 5, 0), CFrame.new(0, 2, 0))

By using the CFrame.Angles function, you can create euler angles to rotate a CFrame.

CFrame.new() * CFrame.Angles(math.rad(20), 0, 0)

Do note that when using euler angles, angles are represented in radians, so in order to convert radians to degrees, I used the math.rad function in Lua. There are also members of CFrame values, so you from a CFrame, you can retrieve its rotations.

CFrame.new():toEulerAnglesXYZ()

There are also properties like "p" for position, and "lookVector" for the vector the CFrame is pointing towards.

CFrame.new().p
CFrame.new().lookVector

The matrix itself can be accessed using components.

CFrame.new():components()

Also CFrame values can be altered using object and world coordinates.

CFrame.new():toObjectSpace(CFrame.new()) -- a tad pointless

You may also apply arithmetic operations to CFrames (and CFrames/Vector3s to each other)

CFrame.new() + CFrame.new(0, 2, 0)

That's just some initial information off the top of my head, I can't guarantee the accuracy of this information because of this. Check out the ROBLOX Wiki for more information.


First,go your place then click RobloxStudio (Black button on the left that says "iii"), then, click the toolbox button (with 2 tools, orange and blue), then, click the "down arrow" (black) Then, click free models. After that click the search bar and put in "edit cframe" then click a blank spot, then click "1" but first put in at least 2 bricks in then click a brick and use the gui that shows up.thats all.


Game.Selection:Get()1 v.CFrame = v.CFrame + Vector3.new(0, 0, 0)

That is what I'd prefer to use though you could change/add stuff to it such have the EulerAnglesxyz()

It will look like this:

Game.Selection:Get()1 v.CFrame = v.CFrame + Vector3.new(0, 0, 0) and v.CFrame = v.CFrame + EulerAnglexXYZ(0, 0, 0)

If I may not be correct, please correct me. Thanks, iTerm


See http://wiki.roblox.com/index.php/CFrame_positioning

game.Workspace.Brick.CFrame = CFrame.new(0, 10, 0) for positioning

game.Workspace.Brick.CFrame = Workspace.Brick.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 0) for tilting

just edit the values in between the ()


The easiest way to cframe is through a cframe tool (get one on free models or the catalog, be aware some might be infected), there are some problems with that though, cframe tools only work well on anchored bricks, and they do not tell you if you are going inside the brick or not, cframing with the command bar will allow you to cframe but without having bricks going into other bricks. I reccomend the cframe tool because you can use it easily and build mode people ajust alot easier, and it's fun for the advanced player to play around with something fun like that. Plus the cframe tool has more options, you can see what degree and place it's at, ajust at will, no typing, you can go inside other bricks, and it's pretty easy to see if it's overlapping or not. Just deselect and you'll see. Use a CFRAMER TOOL, NOT A ANIMATOR! There's a huge difference in mechanics, and the fact that it will acually cooperate. I've never gotten an animator to cooperate. :P


Just insert a brick at your game.Anchor it.Then go to free models.Type cframe or cframe tool.Then pick one click it then grab it.Press on the brick then it depends what type of cframe tool you got.;D


I have found a pretty easy way to CFrame bricks. Open up ROBLOX studio, go to View > Output and View > Toolbars > Command. Now, select the brick in Workspace that you wish to CFrame. In the Command bar, place the following script:

v = Game.Selection:Get()[1] v.CFrame = v.CFrame + Vector3.new(0, 0, 0)

And enter it. Change the last three numbers, (0, 0, 0) to the studs in which you want your brick to move. The first number is left and right, the second is up and down, and the third is close up and far away (depth).

This is how I CFrame because of multiple reasons:

  • It is quick
  • If you make the variables really tiny decimals, you can place the brick very precisely.
  • You do not constantly have to reenter the names of your bricks in your script, you simply select the brick you want to CFrame.

                                                                   ~Davillion
    


Here is a C-Frame tool pack made by me: http://www.roblox.com/Bubbas-C-frame-Tool-Pack-item?id=41704811 The tools are pretty self-explanitory.


Workspace.Brick.CFrame = CFrame.new(0, 0, 0) --Basically changing the Position of a Part in Workspace named "Brick". Using CFrmae for this is good because with it, you can go through objects.

Workspace.Brick.CFrame = Workspace.Brick.CFrame * CFrame.Angles(0, 0, 0) --Use the new way :3, this Rotates a Part in Workspace named "Brick" on it's axis by x Radians x = your amount You should do it this way


Well, here is one of the most simple ways, other than using a Tool. You can open up your Command Bar in Roblox Studio, Or even in build. And type this

x = Game.Selection:Get()[1] x.CFrame = x.CFrame + Vector3.new(0, 0, 0)

Change the (0, 0, 0) to the position you want it to be

Example:

(1, 2, 3)

Hope I helped,

~TheBinkyp


You can set the CFrame of a a brick via code. You can set the CFrame of a brick equal to a CFrame object. Information about 'CFrame' can be found here: 'https://wiki.roblox.com/index.php?title=CFrame' Note that 'CFrame.new()' will have the coordinates and rotation of (0, 0, 0).

local cFrameObject = CFrame.new()
brick.CFrame = cFrameObject

Another way to affect the CFrame of a brick is by using a ROBLOX Studio Plug-in or use a CFrame tool ingame.


a coordinate frame (CFrame) is a way of saying position, to use it you need to use Vector3 or another CFrame, you can change a Frame by many ways: 1: getting another CFrame you can take a part's CFrame and using it as reference and if you want add some math operations to change it to the one you want

reference = workspace.InsertYourPartHere
part = Instance.new("Part",workspace)
part.CFrame = reference.CFrame + Vector3.new(0,(reference.Size.Y / 2),0)

2: making a new CFrame using Vector3 and CFrame you can change a part's position

part = Instance.new("TrussPart",workspace)
part.CFrame = CFrame.new(Vector3.new(math.random(0,2487),math.random(0,8),math.random(0,2487)))

and so that's the basics of CFrame.... there's more CFrame functions like CFrame.Angles which explains itself


Try this, you can use a Vector3 to CFrame:

MyVector3 = Vector3.new(1,2,3)
workspace.Brick.CFrame = CFrame.new(MyVector3)


Cool is wrong.

Workspace.Brick.CFrame = CFrame.new(0, 0, 0)

-- Basically changing the Position of a Part in Workspace named Brick. Using CFrame for this is good because with it, you can go through objects and use angles.

Workspace.Brick.CFrame = Workspace.Brick.CFrame * CFrame.Angles(0, 0, 0)

-- You can also use the new way, for example using Degree Angles or Radians to rotate objects.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜