generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: This appears to resize in both directions?

Previous Thread :: Next Thread 
Klink45 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
LateralLace is not online. LateralLace
Joined: 19 Sep 2015
Total Posts: 662
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image