Help with swinging system

Hello there!, I am currently making a spider-man web swinging system for fun and practice, the system heavily rely on the built-in rope constraints, thus making me have to send a remote event to the server, which will have some input delays, plus ropes are very glitchy and unstable in my opinion

Here is my current system: https://gyazo.com/65d36d1df0fa64702c6c465f7772fd66

Is there any alternative solution instead of the rope constraints ? I did some research on pendulum motion but I had no idea where and how to implement it in to the system. I am also using a body force that pushes players where they are looking at.

Any help is welcome!

3 Likes

30 views in an hour with no replies. I guess I will have to figure this out myself. :frowning:

2 Likes

looks fire my guy i know nothing about rope swinging scripting etc… but i do know about 3d modelling if you want me to 3d model some buildings i can my discord is Roguegamerone#7334

2 Likes

Hi! Thanks for your reply! I have been waiting for hours for one!. But sadly I am in no need to make this into a full fledged game as this is just for fun and practice as I stated above in the article. I will consider to contact you if I changed my mind on making a game out of this though.

2 Likes

oh okay thanks i think it would be a pretty good game though

1 Like

I thought so too, but for now the system is still very buggy as, well, rope constrains. I would have to figure out this problem to be able to progress on anything atleast.

1 Like

I am struggling to make my own swinging system, I can’t figure out how to make the player swing on the rope. My character just gets stuck in the air.

You could try listening for the movement keys being pressed and add a force to the player which increases the longer they hold the button to a maximum force. I’m not sure what type of force to apply to the player, so its up to you really (ex: lineForce, bodyforce etc), you just want to apply a steady force. This would help with swinging in a direction, you could also add more inputs to shorten the length of the rope so you could move closer to an object, and another input to increase the length of the rope so you could move in closer. You could also make it so that if you release your ropes while holding down a key you gain an extra burst of speed.

Also make sure when the player stops swinging, the forces are disabled

local maxiumAppliedForce = 150 
local forceIncreaseBy = 0.5
local forceIncreaseTime = 0.1 -- Every 0.1 Seconds force increases by 0.5, this would increase force linerally, you could create your own equation that exponentially increases force at a desired rate. 
local storageTable = {--Add things like the force objects into this table, and the thread you will use to increase the force}

local userInputService = game:GetService("UserInputService")

local thread1 -- All these thread names can be changed to a direction like ThreadRight
local thread2 
local thread3 
local thread4

local function AddForce()
 -- Either a repeat force += 0.5 task.wait(forceIncreaseByTime) or you could run a while loop up to you
end

userInputService.InputBegan:Connect(function(gpe, input)
 -- Check if the input is something youre looking for and if gpe is false 
 -- Check if the player is currently swinging, attributes if you use them, tables if you use those as well 
 -- Based on the key apply a force in a direction (this would not account for a direction your character is moving in if that makes sense so you could do some math using rightVectors and a player's lookvector to determine which direction is actually left and right 
 -- Add the force to the table and set one of the threads to the AddForce function (make sure to task.spawn() it or use corountines 
-- You could also add a wait here and check if the key is down just to make certain they aren't just tapping the key

userInputService.InputEnded:Connect(function(input, gpe)
 -- Not sure if you can have this inside or out of previous event, but ill leave it in here for now 
 -- Find the thread in the table, based on the thread you selected previously 
 -- task.cancel(thread), find the force corresponding to the direction and disable that as well 
end)

end)

This isn’t meant to be a full script or anything you could seriously use (without major adjustments) its just an idea of how it can be structured.

1 Like