Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 16 Apr 2016 09:48 PM |
function resizeIgnoreObjects(part, normalId, delta) assert(delta > 0, "Delta must be a positive number.") local oFrame = part.CFrame local normalVector = Vector3.FromNormalId(normalId) part.Size = part.Size + (vectorAbs(normalVector) * delta) part.CFrame = oFrame + normalVector end
I just want it to resize my parts in one direction, but, say for instance, I want to resize it down, it resizes it up as well. Can anybody fix this?
u sicko! |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 16 Apr 2016 10:14 PM |
I really need help with this.
u sicko! |
|
|
| Report Abuse |
|
|
Hyperant
|
  |
| Joined: 05 Apr 2013 |
| Total Posts: 615 |
|
|
| 16 Apr 2016 10:17 PM |
| Simplest solution is to reposition the part by half its size forwards, backwards or the direction of your resizing. |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 16 Apr 2016 10:25 PM |
Um, mind giving me an example? I'm not the best when it comes to positions and CFrame and stuff.
u sicko! |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 16 Apr 2016 10:31 PM |
I see you've found my code here: https://forum.roblox.com/Forum/ShowPost.aspx?PostID=187320278
You are right, there is a big in it when rotated. Here is a fix that I have tested and works. Resizing and positioning correctly:
function vectorAbs(vec) return Vector3.new(math.abs(vec.x), math.abs(vec.y), math.abs(vec.z)) end
function resizeIgnoreObjects(part, normalId, delta) assert(delta > 0, "Delta must be a positive number.") local oFrame = part.CFrame local normalVector = Vector3.FromNormalId(normalId) part.Size = part.Size + (vectorAbs(normalVector) * delta) part.CFrame = oFrame * CFrame.new(normalVector * (delta/2)) end
resizeIgnoreObjects(workspace.Part, Enum.NormalId.Bottom, 2) |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 16 Apr 2016 10:38 PM |
@nox That was actually me on an alternate account that I use for developing. Thanks for the fix, I'll try testing it and see if it works.
u sicko! |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 16 Apr 2016 10:39 PM |
IT WORKED! I AM SO HAPPY RIGHT NOW! NOX, YOU ARE AMAZING!
u sicko! |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 16 Apr 2016 10:42 PM |
Oh yes, I know.
:P Kidding. Modesty is a keystone. Glad it helped you with your project. |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 11:01 PM |
| Is it just me or couldn't you have used the resize function build into the part API to get the same results? |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 16 Apr 2016 11:07 PM |
"Is it just me or couldn't you have used the resize function build into the part API to get the same results?"
It will not resize through objects, which was his issue. |
|
|
| Report Abuse |
|
|