Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 14 Dec 2016 02:06 PM |
I'm writing this script for someone who requested a "susanoo" morphing-thing. I'm nearly there, and I think my method is effective... It's just the last bit that's tripping me up. Has to do with welds.
I was NOT making this code with neatness in mind, the part where I look over the values of the BodyScale Humanoid values is ugly, but, I don't care right now.
I put in a wait(2) before the character model is scaled down again to better illustrate how the process works, and my issue.
ghee-ahh-zoh .gif link, a demonstration of the problem /6cfbe0659e3ad3252ed20c8c85a21e46
The code paste bin. com/ peq8Hjs1
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 14 Dec 2016 02:07 PM |
For context on what a "susanoo" apparently is, here is the requester's thread: https://forum.roblox.com/Forum/ShowPost.aspx?PostID=204373878
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 14 Dec 2016 02:39 PM |
| I can't really see the problem (the resolution is really small). Can you explain the problem? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 14 Dec 2016 02:45 PM |
Essentially I scale up the R15 character using the new body scaling-values in the Humanoid. Once they are grown, I make a copy of all the limbs, rename them to "Susanoo"..limb.Name, change their transparency, and weld them to the character. Now, when the character shrinks back to scale 1-1-1, I'd like for the Susanoo parts to stay welded to where they were.
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 14 Dec 2016 02:47 PM |
The end result should be your character floating in the Susanoo's torso, and the Susanoo's movements mimicking your own.
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 14 Dec 2016 02:48 PM |
There is some garbage code in the paste bin that doesn't do anything, like the Positions dictionary- I forgot to remove that but was experimenting.
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 14 Dec 2016 02:49 PM |
| You'll have to alter the C0 to account for the offset when you resize the character. A quick way would be to save the current CFrams of those parts before you set all of those values back to 1, then re-set C0 of all the welds using the previously saved CFrames. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 14 Dec 2016 03:01 PM |
I attempted something like that, using the Positions table, however when I scaled the model down and attempted to alter the c0 like this...
for _,v in next,SusanooParts:GetChildren() do local limb = char:FindFirstChild(string.sub(v.Name,8,#v.Name)) local weld = Instance.new("Weld",v) weld.Part0 = v weld.Part1 = limb for _,pos in next,Positions do if pos[1] == v.Name then weld.C0 = pos[2]:inverse() * limb.CFrame end end v.Anchored = false end
-- I was met with the same result, a small hobbling ball of parts
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 14 Dec 2016 03:03 PM |
The pos[2] value is defined like this...
local Positions = {}
for _,v in next,char:GetChildren() do if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then local vClone = Instance.new("Part") vClone.Anchored = true vClone.CanCollide = false vClone.Size = v.Size vClone.CFrame = v.CFrame vClone.Name = "Susanoo"..v.Name table.insert(Positions,{vClone.Name,vClone.CFrame})
|
|
|
| Report Abuse |
|
|
| |
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 15 Dec 2016 01:46 PM |
Happy to, I like solving unfamiliar problems.
|
|
|
| Report Abuse |
|
|
|
| 15 Dec 2016 02:54 PM |
why is your code not indented
Downgrading STF // https://www.roblox.com/Trade/TradeWindow.aspx?TradePartnerID=6163444 |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 19 Dec 2016 06:33 AM |
Because I do most of my coding here on the forums
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 19 Dec 2016 06:36 AM |
!! Help me satisfy my jesus complex and brainstorm solutions to this other guy's problem !!
|
|
|
| Report Abuse |
|
|
|
| 26 Jan 2017 10:32 AM |
Hey I could use your help, I need to weld a sword model called "SWORD" on the back of my r15 players torso. I would be really happy if you helped me :)
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Jan 2017 10:50 AM |
function WeldToBack(part,torso) local weld = Instance.new("ManualWeld",part) weld.Part0 = part weld.Part1 = torso weld.C0 = torso.CFrame * CFrame.new(0,0,-2) *CFrame.Angles(0,0,0) -- adjust the CFrame.Angles to get your desired orientation end
WeldToBack(workspace.SomeTool.Handle,player.Character.UpperTorso) -- change these two parameters
|
|
|
| Report Abuse |
|
|
Darsnic
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 198 |
|
|
| 26 Jan 2017 11:25 AM |
Huh, you just solved that guys question, another guys question, and my question, all in one thread.
gj op |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Jan 2017 11:45 AM |
Happy to inadvertently help
|
|
|
| Report Abuse |
|
|
| |
|
|
| 26 Jan 2017 04:25 PM |
| why not just do it manually lol |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Jan 2017 04:27 PM |
C0 takes an offset, and typically you set Part0 to the 'base' part (and +z = back) so like:
function WeldToBack(part,torso) local weld = Instance.new("ManualWeld") weld.Part0 = torso weld.Part1 = part weld.C0 = CFrame.new(0,0,2) *CFrame.Angles(0,0,0) -- adjust the CFrame.Angles to get your desired orientation weld.Parent = torso end
|
|
|
| Report Abuse |
|
|
|
| 26 Jan 2017 04:42 PM |
ur turning g2y bc you can't get a girl we get it
wasn't hard to explain |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Jan 2017 05:20 PM |
So after setting Part0 and Part1 the object you are welding to the base part is automatically put to the base part's position?
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Jan 2017 05:21 PM |
Uhh oops confused myself After setting Part0 and Part1, the part you are welding to the base part is automatically put to the base part's position? *
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Jan 2017 05:23 PM |
| Yeah. This is how welds/motors work: part0.CFrame * C0 = part1.CFrame * C1 Since C1 is an 'empty' (identity) CFrame: part1.CFrame = part0.CFrame * ## C0 is a CFrame in the object-space of part0. So if C0 = CFrame.new(0, 0, 2): part1.CFrame becomes part0.CFrame * CFrame.new(0, 0, 2) |
|
|
| Report Abuse |
|
|