Hello!
I’ve been working on a couple of projects of mine… and i’ve been wondering something.
You know how in certain games like combat warriors, where if you equip a bow or a RPG, the 4 symbols
around you mouse will smoothly tween into a different position? (to symbolize accuracy and stuff)
(if you dont know what i mena, you could probably look it up)
Yea so… thats what I am trying to do… I have tried searching but i found nothing of use.
Any help is appreciated
Hey there, interesting… I had the same question.
So I looked into a good old free model FE Gun kit.
Searching for GUI related to crosshairs in the local script I found this function.
From this I have concluded they have used a spring to make the crosshair bloom out and in.
local function RenderCrosshair()
local Size = CrossSpring.p * 4 * CrossScale.p --* (char.speed / 14 * (1 - 0.8) * 2 + 0.8)*(char.sprint + 1) / 2
for i = 1, 4 do
CrossParts[i].BackgroundTransparency = 1 - Size / 20
end
CrossParts[1].Position = UDim2.new(0, Size, 0, 0)
CrossParts[2].Position = UDim2.new(0, -Size - 7, 0, 0)
CrossParts[3].Position = UDim2.new(0, 0, 0, Size)
CrossParts[4].Position = UDim2.new(0, 0, 0, -Size - 7)
end
Video effect for reference:
Probably use a Spring module and Apply force on it to get the desired effect. That’s where I recommend you to start.
Introduction
I’ve created a module that allows you to create a realistic spring object that acts in one direction. This module creates a general solution to a second order differential equation given some inputs. It’s simple to use and is very useful in creating recoil systems, realistic spring systems, and anything else you can imagine a spring is useful for. This spring module is able to accurately replicate real springs. I included the full explanation of the math in this post, and I also in…
Hello. Ive watched this “spring module” thing, and looked into the FE Gun script, to find… not really much of use… I am kinda confused on how i would convert this stuff to gui position
Hello. I have finally found the answer to my question.
Based on different posts on spring module, I was able to come up with this code.
local springModule = require(game.ReplicatedStorage.Gameplay.Scripts.ModuleScripts.Spring)
local spring1 = springModule.create()
local randomSpring = Random.new()
local folder = game.Players.LocalPlayer.PlayerGui.Hitmarker.MainFrame.Markers
game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
local movement = spring1:update(deltaTime)
folder[1].Position = UDim2.new(0.5,0,0.524,0) + UDim2.new(0, 0, movement.Y, 0)
folder[2].Position = UDim2.new(0.515,0,0.5,0) + UDim2.new(movement.X/2, 0, 0, 0)
folder[3].Position = UDim2.new(0.485,0,0.5,0) + UDim2.new(-movement.X/2, 0, 0, 0)
folder[4].Position = UDim2.new(0.5,0,0.475,0) + UDim2.new(0, 0, -movement.Y, 0)
end)
while task.wait(1) do
spring1:shove(Vector3.new(0.5,0.5,05))
end
Although it does the spring automatically, I can hook it up to a remoteEvent. Thanks for your help @dthecoolest
system
(system)
Closed
April 8, 2023, 7:58pm
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.