thepie56
|
  |
| Joined: 06 Jun 2008 |
| Total Posts: 10 |
|
|
| 30 Sep 2013 02:56 PM |
So I have been learning a bit about scripting and I have recently been fooling around with CFrame movement. As so;
p = game.Workspace.Part
for i = 1,20 do p.CFrame = CFrame.new(91.5+i, 19.8, -7) wait() end
I noticed that in order for it to start from the point I want it to, I have to put in the current position then the variable(91.5+i, 19.8, -7) with the 91.5 being the X axis. Is there a way I get the object to locate itself and move from there on? Feel free to ask for more info if you don't understand what i'm asking. |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2013 02:58 PM |
p = game.Workspace.Part
for i = 91.5,111.5 do p.CFrame = CFrame.new(i, 19.8, -7) wait() end
There ya, its just simply changing the numbers in the for loop. However there is a ton of different ways you could do this. Have fun scripting :) |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2013 03:07 PM |
| What's the difference between CFrame and Vector3??? Cause I noticed Vector3 moves when you touch it, IDK about CFrame. |
|
|
| Report Abuse |
|
|
thepie56
|
  |
| Joined: 06 Jun 2008 |
| Total Posts: 10 |
|
|
| 30 Sep 2013 03:08 PM |
| Yea, I know that :P I meant that if I moved the brick, it would move from the position I moved it to, and I wouldn't have to put in the new position. It would just locate itself and move from the position it's currently in. |
|
|
| Report Abuse |
|
|
thepie56
|
  |
| Joined: 06 Jun 2008 |
| Total Posts: 10 |
|
| |
|
|
| 30 Sep 2013 03:12 PM |
| I dont quite understand what your asking then. |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2013 03:15 PM |
p = game.Workspace.Part
for i = 1,20 do p.CFrame = CFrame.new(p.CFrame.X+1,p.CFrame.Y,p.CFrame.Z)-- I put plus one because adding i wouldnt make it tween. wait() end |
|
|
| Report Abuse |
|
|
XAXA
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 6315 |
|
|
| 30 Sep 2013 03:21 PM |
p = game.Workspace.Part pCFrame = game.Workspace.Part.CFrame
for i = 1,20 do p.CFrame = pCFrame + CFrame.new(1,0,0) -- changing "1" to "i" in this line will make the block accelerate. You may not want that. wait() end |
|
|
| Report Abuse |
|
|
thepie56
|
  |
| Joined: 06 Jun 2008 |
| Total Posts: 10 |
|
|
| 30 Sep 2013 03:21 PM |
| Works like a charm, thanks man! |
|
|
| Report Abuse |
|
|
XAXA
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 6315 |
|
|
| 30 Sep 2013 03:21 PM |
| JoshuaKempfert's method will work, too. |
|
|
| Report Abuse |
|
|
thepie56
|
  |
| Joined: 06 Jun 2008 |
| Total Posts: 10 |
|
|
| 30 Sep 2013 03:25 PM |
Yea, was thanking him and then your post popped up right after :P Both still work though, so thank you both.
:) |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Sep 2013 03:32 PM |
| xaxa, you cant add CFrame values |
|
|
| Report Abuse |
|
|
XAXA
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 6315 |
|
|
| 30 Sep 2013 03:38 PM |
http://wiki.roblox.com/index.php/CFrame
I do this all the time in the command bar... |
|
|
| Report Abuse |
|
|