EzUISprings - Simple UI Movement Module

Yeah uhhh, I updated it a couple days ago and it doesnt take those constructors anymore.
There’s a small example at the top inside the modulescript that could help you, but I should probably make a new writeup on how to use it since that little bit clearly wasn’t enough xd, my apologies.

UISpring:Apply3DSpringEffect() takes in an optional SurfaceGuiProperties table, which is just a dictionary of properties for it, something like this:

UISpring:Apply3DSpringEffect({
   LightInfluence = 0;
   ZIndexBehavior = Enum.ZIndexBehavior.Global;
   --etc. etc.
})

If you want to change the properties of the spring effect, thats now done with a new parameters constructor for when you first make the UISpring object.

local SpringParams = EzUISprings.newSpringParams()
local UISpringObject = EzUISprings.new(MyGuiObject, SpringParams)

The SpringParams governs the behaviors of the spring, and is just a dictionary given this type:

type SpringParams = {
	SizeFactor: number;
	SpringIntensity: number;
	MouseIntensity: number;
	UseCameraFocus: boolean;
	ShowDebug: boolean;
	MouseCap: Vector2;
	BaseRotationOffset: Vector3;
};

You can also apply new spring params after you start displaying the object too, with UISpring:UpdateSpringParams(NewSpringParams)

In the end though, your new script should look something like

local EzUISprings = require(...) --path to module
local MyGuiObject = (...) -- path to object

local SpringParams = EzUISprings.newSpringParams({
  SpringIntensity = 2;
  BaseRotationOffest = Vector3.new(0, -90, 0);
})

local UISpringObject = EzUISprings.new(MyGuiObject, SpringParams)
UISpring:Apply3DSpringEffect({})

Let this be a lesson to myself not to update things out of the blue without writing extensive documentation! If there are any more issues then i’ll make a full write up but for now i will leave it be.

1 Like

…ok im just dumb, didnt think on checking the module itself lol…yeah, doesnt show up errors now and works better, thank you man and sorry for the trouble, loved the module

1 Like

C̶h̶a̶n̶g̶i̶n̶g̶ ̶t̶h̶e̶ ̶r̶o̶t̶a̶t̶i̶o̶n̶ ̶d̶o̶e̶s̶n̶’̶t̶ ̶s̶e̶e̶m̶ ̶t̶o̶ ̶w̶o̶r̶k̶ ̶w̶i̶t̶h̶ ̶t̶h̶e̶ ̶u̶p̶d̶a̶t̶e̶d̶ ̶v̶e̶r̶s̶i̶o̶n̶.̶ ̶T̶h̶e̶ ̶3̶D̶ ̶m̶o̶u̶s̶e̶ ̶e̶f̶f̶e̶c̶t̶ ̶d̶o̶e̶s̶n̶’̶t̶ ̶w̶o̶r̶k̶ ̶e̶i̶t̶h̶e̶r̶.̶ ̶I̶t̶ ̶s̶e̶e̶m̶s̶ ̶l̶i̶k̶e̶ ̶c̶h̶a̶n̶g̶i̶n̶g̶ ̶t̶h̶e̶ ̶S̶p̶r̶i̶n̶g̶P̶a̶r̶a̶m̶s̶ ̶d̶o̶e̶s̶n̶’̶t̶ ̶a̶f̶f̶e̶c̶t̶ ̶a̶n̶y̶t̶h̶i̶n̶g̶ ̶a̶t̶ ̶a̶l̶l̶.̶

Edit: Nvm, the code example you posted to the devforum doesn’t work. Using the example included in the actual module does work.

i apologize for reviving this dead topic, but i do have a question, how could i go about making this work for a custom camera?

normally it looks like this

but when i use a custom camera offset, it dissapears

i tried reading the code of the module but i just couldnt figure out how to offset the position of the surface gui

Are you using a secondary camera or modifying the camera that is being used already by the player?

i am modifying the default camera and giving it an offset to create this effect

Huh weird, my gut is telling me that the renderpriority for the effect needs to be set after camera, but im not entirely sure.

I don’t currently have my computer atm but I’ll make a new option in the SpringParams that lets you edit that. — Probably in a day or two

This is probably one of, if not the best UI utilities out there. I have been looking for a module capable of organizing a 3d HUD aspect to UI. Definite vouch from me!

1 Like

i was going to use the 2d thing for a sway but its gone now :disappointed_relieved:

I’ll work on readding it when I get back home after school assuming I don’t collapse onto my bed.
The reason I removed it in the first place was because it’s kinda common and easy to do in the first place so I just assumed nobody needed it. I should probably stop doing that…

Change Log V 1.2:

→ Functionality Changes

  • Added a new, separate type for 2D spring effects.
    It’s the same as the normal 3D variant… except 2D!!! wow.
    This type is made with EzUISprings.new2D() and takes (GuiObject: GuiObject, SpringParams2D: SpringParams2D?) as constructors.
  • You can now set the camera you wish to use as reference in the SpringParams, although it will default to the CurrentCamera if one is not set.
  • Got rid of some random prints that I forgot about. (Sorry!)

New version, as always, is on the toolbox and also downloadable as a .rbxm file here.

1 Like

Hey, I believe the modules rotation is broken? I’m not sure if I’m using it incorrectly but the following happens when I try to change the rotation by even a bit. I have tried TextLabels, Frames, using decimal points for the rotation but it all ends up the same.

local uiSprings = require(game.ReplicatedStorage.Modules.Utils.EzUISpring)
local textLabel = script.Parent.Frame

local springParams = uiSprings.newSpringParams()
springParams.SpringIntensity = 15
springParams.BaseRotationOffset = Vector3.new(1, 0, 0)

local uiSpringObject = uiSprings.new(textLabel, springParams)
uiSpringObject:Apply3DSpringEffect()

textLabel.TextLabel1.MouseButton1Click:Connect(function()
	print("hi")
end)

(file was too large so I uploaded to google drive)

Hey yeah, so I made an oopsie and accidentally slotted in BaseRotationOffset for BasePositionOffset.

As you can tell, I didn’t test it at all lol :sweat_smile:
I’ve updated the toolbox and .rbxm file and it should be fixed now, just re-insert the module.

Hey! Late reply and I don’t mean to bring this up 6 months later but anyway,

Everything works perfectly but I have one issue that i can’t seem to figure out. When the FOV is changed the GUI scales up and cuts off. Any way to fix this? Idk if it has to do with this module or not but I’m just gonna make sure. Thanks!

adding onto this, i have tried UIAspectRatioConstraint and as that sorta fixed it, it still cuts off, just not as much as before I tried UIAspectRatioConstraint.

and also to give more clarification, im using that rotate thing u added

local springParams = uiSprings.newSpringParams()
springParams.SpringIntensity = 3
springParams.BaseRotationOffset = Vector3.new(3, 0, 0)

local uiSpringObject = uiSprings.new(textLabel, springParams)
uiSpringObject:Apply3DSpringEffect()

last time adding onto this but after a bit of playing around w it, I noticed that when the fov is changed the surface gui ultimately streaches out. idk if theres a simple way to fix this and im just having a brain freeze rn but yea.

There’s a bug where if you reset character or the character dies, the ui disappears
I have ResetOnSpawn set to false on the ScreenGui and the :Apply3DSpringEffect({ResetOnSpawn = false}) but the problem is that the ui keeps on disappearing when you reset

(i deleted the other post because of how messy the clip is)

Also ignore the background audio in the clip!! I forgot i had my mic muted :sweat_smile:

is line 376 misspelled?
self.MouiseSpring:shove(Vector)

instead of

self.MouseSpring:shove(Vector)

@BOSSBABY618
Sorry for the supppper late response lol
Everything in startergui, gets cleared unless it’s an object ResetOnSpawn set to false. I was using a folder to store all of the surface gui’s (which would get destroyed even with children that had ResetOnSpawn disabled, pretty simple, but this should be fixed now.

By default they will still reset on spawn, but I added this as an option to SpringParams so that you can change it, and it checks this parameter when you create the object.

:sweat_smile: woooops no idea how that slipped through

The module has been updated to address this, i’m such a bad maintainer lol.
As usual, here’s the new .rbxm file, or you can just grab the new version from the toolbox.

1 Like

Oh my. This is one of te best resources ever dude! Thank you so much!!! It goes a little but cuckoo when you zoom out but it’s nothing massive. Thank you so much!