Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible wiremod expression2 constraintcore rope-constraint setLength() bug #3090

Open
raven1934 opened this issue Jul 2, 2024 · 5 comments

Comments

@raven1934
Copy link

Hello, a project of mine requires a rope constraint that is updating it's length during run, I tried to use winch for this but due to winches custom physics that make it super unrealistic on its behaviour, I tried to replicate what my goal was in rope-constraints, but for some reason even if the documentation of e2 says you can set rope constraints lengths by setLength() it doesn't work as expected but rather nothing happens.

I'll post here the rough setup of my project in hopes someone knows whether this is a bug or limitation to the rope-constraint itself:

To create rope constrain during the initialization of chip:
rope(1,SubObject,vec(0,0,0),MainObject,vec(0,0,0),0,0.2,"cable/cable2")

During the running on update loop:
SubObject:setLength(1,sin(EllapsedTime*25)*20)

According to wiremod documentation:
Entity:setLength(Number Index, Number Length) - Sets the length of a winch/hydraulic/rope stored in this entity at a referenceid

If you have any information on how to fix it on my side or in the constraintcore, all help is appreciated.

@thegrb93
Copy link
Contributor

thegrb93 commented Jul 2, 2024

Might be a gmod bug. Starfall doesn't have the ability to set rope lengths either. You can try doing it with an elastic though.

@Fasteroid
Copy link
Contributor

I also experienced this when designing my E2 wrecking ball mech, but I worked around it by destroying and recreating the rope as needed. Should probably look into fixing this though.

@unknao
Copy link
Contributor

unknao commented Jan 18, 2025

I'm pretty sure source doesn't allow you to change the rope length on the fly without recreating the rope itself, the documentation itself is erroneus.

See:
https://developer.valvesoftware.com/wiki/Phys_lengthconstraint (ropes)
https://developer.valvesoftware.com/wiki/Phys_spring (elastics/hydraulics)

@raven1934
Copy link
Author

I found a scuffed method to get the rope to correct length, as unknao mentions the method is to recreate rope itself, but with a length parameter that is the amount of reelback or reelout you want from the default height... it's suboptimal as i think it messes with the objects physics due to being and constraint that is recreated during flight (if i throw my clawmachine around it kinda acts like something is pulling on it mid-flight almost like drag) but it seems the workaround works for stationary objects just fine.

@thegrb93
Copy link
Contributor

Someone could create a garrysmod-issue to see if its possible for a binding to be added to set rope length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants