|
| 18 Apr 2014 01:05 PM |
What I'm trying to do is add get all of the parts in a model to a table, and save all of their CFrame values to a table. Then, I want to change all of the parts' CFrame values, relative to their original saved values.
This almost works, except it thinks they should all be relative to a single part, instead of themselves.
In this case, the Torso. All of the limbs are moved relative to the Torso's original position, instead of their own original positions. They should move relative to their own.
No output, the script is functional, but not in the right way.
faf = script.Parent:GetChildren()
cframetable = {}
for w = 1,#faf do if faf[w]:IsA("Part") then table.insert(cframetable,#faf,faf[w].CFrame) end end
for v = 1,20 do wait(0.01)
for i = 1, #faf do if faf[i]:IsA("Part") then faf[i].CFrame = cframetable[#faf] * CFrame.fromEulerAnglesXYZ(math.random(-5,5)/50,math.random(-5,5)/50,math.random(-5,5)/50) end end end
|
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Apr 2014 02:48 PM |
| Is there something else I need to post? |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Apr 2014 04:13 PM |
table.insert(cframetable,faf[w].CFrame)
|
|
|
| Report Abuse |
|
|
spearman2
|
  |
| Joined: 28 May 2010 |
| Total Posts: 2938 |
|
|
| 18 Apr 2014 04:13 PM |
table.insert(tostring(cframetable,#faf,faf[w].CFrame))
Making it a string...could probably help...or make things worse. |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2014 04:15 PM |
for I,v in pairs(faf) do if v:IsA("Part") then v.CFrame = cframetable[v.CFrame] * CFrame.fromEulerAnglesXYZ(math.random(-5,5)/50,math.random(-5,5)/50,math.random(-5,5)/50) end end
not entirely sure |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2014 04:40 PM |
@island your suggestion gives me this error:
14:39:51.314 - Workspace.animatedscene1.1.Script:19: bad argument #1 to '?' (CFrame expected, got nil) |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2014 04:44 PM |
@spearman It obviously just wants a table, not a string.
14:43:43.706 - Workspace.animatedscene1.1.Script:9: bad argument #1 to 'insert' (table expected, got string) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 20 Apr 2014 01:12 PM |
What are you trying to accomplish, a feature that saves your position, and loads it when you rejoin?
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|
transIate
|
  |
| Joined: 20 Jun 2013 |
| Total Posts: 2699 |
|
|
| 20 Apr 2014 01:14 PM |
| sorry your script is too spread apart ): |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2014 01:20 PM |
| What I'm trying to do is save each part's CFrame to a table, and then move them all, relative to the saved values. |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2014 01:22 PM |
What do you need that for exactly? I don't quite understand what this would be useful for.
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2014 01:27 PM |
| It's for a video. I'm animating characters with scripting in some of it. This particular part needs the character to shiver, sort of. I know it would look weird, but that's pretty much the point. |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Apr 2014 01:58 PM |
Try using the ToObjectSpace method of a CFrame: http://wiki.roblox.com/index.php?title=CFrame#Methods
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2014 02:03 PM |
I don't know what you're trying to say there. I already have a method of animating. This shivering bit already -almost- works. The table is the problem.
I need to read each part's unique CFrame from the table, to have the center point for each part to move the CFrame relative to.
I know this can work, it moves them relative to the Torso as of now, but if they all were relative to their own saved CFrame values, then it would work and I would be on my way. |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2014 02:11 PM |
| Try adding it to a string? |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2014 02:17 PM |
Spearman2 suggested that but his snippet of code for it only caused an error when I implemented it.
How else could I use a string for this? |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2014 02:49 PM |
| I'm on to something with strings but I know I'm doing it the long way.. WAY long way... |
|
|
| Report Abuse |
|
|