Jump to content
Sign in to follow this  
Helmut Duregger

HEDU_Rope - a physics rope for Arma2

Recommended Posts



https://github.com/hduregger/HEDU_Rope/raw/master/HEDU_Rope.png 904 kb!



https://github.com/hduregger/HEDU_Rope

Please look into HEDU_Rope.hpp, the example mission and

example.sqf for information on how to use this.

Tested with Arma2 1.08.

Works good enough here with 5 nodes. With more nodes it usually renders everything twice due to the nature of Arma2 scripts. Will behave jerky sometimes.

When manually 'attaching' objects to the tip of the rope by updating their position yourself, objects that have gravity applied by the game engine may jerk downwards. Objects that don't have gravity applied work very well though.

Includes the complete sources.

Enjoy!

DOWNLOAD

PS: @Dwarden, it works with the Czech hedgehog :-D

COPYRIGHT: Everyone is free to change and re-release this. Enhance it, add it to your mods and if you are a kind person also mention my name.

UPDATES: I currently don't plan on enhancing this. The reason is that I am waiting for what ropes Take on Helicopters will hopefully bring us. Take on Helicopter's features might make this completely obsolete. I also lack any knowledge on how to make this work over network etc. So if you know the magic and are motivated, please feel free to enhance and re-release this.

Edited by Helmut Duregger
added copyright and update information

Share this post


Link to post
Share on other sites

Great job mate. I´d like to see it implemented within A.C.E

Share this post


Link to post
Share on other sites

Although I'd rather prefer civilian usage, the A.C.E. team is free to implement it into their awesome mod.

I hope it will be useful. It is a bit sensitive with performance changes. I mostly only tested it in a deserted utes scenario.

Share this post


Link to post
Share on other sites

Helmut Duregger

Please watch your file sizes, do not hotlink images > 100 kb.

And the ACE2 Mod is as 'civilian' as any other Mod out there.

Share this post


Link to post
Share on other sites
Helmut Duregger

Please watch your file sizes, do not hotlink images > 100 kb.

And the ACE2 Mod is as 'civilian' as any other Mod out there.

Pretty sure he means like rescue etc non-military actions

Share this post


Link to post
Share on other sites
Great job mate. I´d like to see it implemented within A.C.E

As long as that is NOT at the expense of those that don't use ACE that much. Thanks

Downloading to test now.

Good job.

Share this post


Link to post
Share on other sites

Helmut,

I must say I am impressed with this! A very well thought out design! I was just thinking about a winch addon that could provide tow/recovery options, and I think this could do the trick.

A few questions:

- It isn't obvious to me whether the addon can be used for other vehicles besides helicopters. The sample script uses a helo, but it would seem it could be used for other vehicles by calling the script in that vehicle's init, or perhaps via an action, yes? I am considering making a generic winch object that may be attached to a vehicle bumper via the attachto command to make this easier to accomplish. This could affect the use of the flaps controls on a non-air vehicle but simply remapping the key could fix it. The idea would be to use it for towing/recovery or even winching a stuck vehicle up a steep incline. The problem here is that the rope man would have to take control of the rope end, but it may be that the car driver could select (via the cursor?) an anchor point for the rope end to attach to.

- Can the keys be remapped from the flaps controls? Again thinking about use with a non-air vehicle I am wondering if the flaps controls would still work.

- I'm not sure how something other than a man would react with the gravity calculation. Can it be configured so it doesn't "bounce" as much? It seems fairly easy with the Arma engine to make the player fly up into the rotors by altering your altitude downward. Even at what I thought was a reasonable descent, the rope man tends to fly into the rotors. Considering the game engine physics, I think it needs to be dampened somewhat to avoid these impossible situations.

- Would there be a way to add an action to the end of the rope so a player could "attach to / detach from" the rope? I presume it would be to modify the script a little bit. This could allow for example the connection to a vehicle, object, ammo crate, etc. etc. for airlift and towing purposes.

Congrats!

Edited by hcpookie

Share this post


Link to post
Share on other sites

- It isn't obvious to me whether the addon can be used for other vehicles besides helicopters. The sample script uses a helo, but it would seem it could be used for other vehicles by calling the script in that vehicle's init, or perhaps via an action, yes?

The addon basically is only the rope. As shown in the example script and mission you can quite easily simulate a winch by just changing the length dynamically.

It is possible to attach the rope to any object you like. Since you can attach multiple nodes of the rope to objects, it would be possible to create thing like power lines and then simulating some wind movement on that. You would have to compute and apply the wind force yourself though. But my imagination is carrying me away.

As a starter for your winch you could just try to use the setup in the example script and remove the rotation being applied to the man on the rope.

Yes you could call that script in any vehicles init. Mind though that the current example script uses some global variable names ("chopper", ...) that the involved objects have. You would have to change that to make sense. Best practise might be to pass the objects you want to affect by your winch directly to the winch initialization script.

- Can the keys be remapped from the flaps controls? Again thinking about use with a non-air vehicle I am wondering if the flaps controls would still work.

The key mapping in the example script to the flaps controls is also just an example, there is no rule on what key you use to control the rope's length. You don't even have to change the length if you don't want to. It's just that your script has access to the length if you want. I used the flaps keys for testing because I did not use them for something else and it would be unpractical to lower the rope in steps of 10 cm by repeatedly selecting an action. Of course for things that you don't do repeatedly per second, like attaching the rope to some object, actions are fine.

- I'm not sure how something other than a man would react with the gravity calculation. Can it be configured so it doesn't "bounce" as much? It seems fairly easy with the Arma engine to make the player fly up into the rotors by altering your altitude downward. Even at what I thought was a reasonable descent, the rope man tends to fly into the rotors. Considering the game engine physics, I think it needs to be dampened somewhat to avoid these impossible situations.

The rope physics are far from perfect and also depend onto the performance of the game on your computer. This comes from how often the postion a rope is attached to is updated by the game engine, or how often gravity is applied to them etc. I fear there is not much we can do about that, and it is maybe also the reason I could not find another rope addon for Arma2. If someone was to create a model of a person that is to be attached to a helicopter rope, then it might be a good idea to create a copy of that model that has no mass and gravity applied, so that the rope behaves better.

But you can tweak the parameters on the rope to your use case. For instance there is a value called damping that just generally makes the rope, or just individual nodes, slower. There is also the spring constant and the air drag value. Please read through the documentation in the HEDU_Rope.hpp file. The parameters of objects influenced by physics calculations always have to be tweaked. That is the case in any game and any computer physics simulation as it will never be accurate. Unfortunately Arma2 script access currently makes it a bit more difficult for us to get usable results.

- Would there be a way to add an action to the end of the rope so a player could "attach to / detach from" the rope? I presume it would be to modify the script a little bit. This could allow for example the connection to a vehicle, object, ammo crate, etc. etc. for airlift and towing purposes.

In short yes. You can check the distance to the end node of the rope to a person for instance. If the person is close enough you could add an action to their action menu and remove it if they move away again etc.

If some things I said confuse you, then don't worry. Look into other addons and scripts to get an idea of how things can be done. There is also a lot of documentation here in the forums and on the web. Usually there is multiple ways of how you can achieve something. I myself have a background in computer games and programming, but this is my first Arma2 addon. And the last related mission editing and scripting I did for this series was for Arma or the original Operation Flashpoint years ago. So I had to learn too.

Share this post


Link to post
Share on other sites

I for one am very impressed with your work here. I like your idea about even the simplist of things such as a moving or swaying power line to add atmosphere or ambiance to an island. Keep up the fantastic work, I hope that you haven't stopped trying to improve upon this.

Share this post


Link to post
Share on other sites

This is really nice looking, but that infinite for loop in your code is quite nasty! Have you tried messing around with a CBA per frame handler type system for this? That would allow you to negate script lag and execute your code inside of a non-scheduled environment.

The system allows you to execute code every single frame (pre-frame render). I think you could get a HUGE performance increase.

Careful though, as it is blocking, if the code is too intense it can start to effect frame rate.

Good luck! ;)

---------- Post added at 06:29 PM ---------- Previous post was at 06:04 PM ----------

Also, while this would be a draw back to how it looks over all, using static lengths of rope between the nodes would be better network performance.

Another option would be to locally create all the rope objects and have the script running on every client that needs it. That way nothing new is really sent over the network besides when to start and stop the simulation of the rope. You would have to devise some sort of alternate attaching object though, as I am not sure how attachTo works when a global object is attached to a locally created one.

Share this post


Link to post
Share on other sites

cool addon, and a great need fullfilled, one question and pardon my ignorance:

is it at all possible to make this in script form, not a addon?

Im asuming no, but asking just in case.

Share this post


Link to post
Share on other sites

Helmut this looks really good. I've been trying to use other addons like Norrin's fastrope and RAV lifter to use ropes in my support assets scripts, but they always look clunky being rigid all the time. A couple questions along those lines...

Would you ever consider adding animations to the addon so that someone can look like they're fastroping? (Something like Norrin's)

And do you know if using multiple ropes attached to the same object (i.e. lifting and carrying a humvee at four corners) would work just as well to have a load sway around. (Something like RAV lifter)

Share this post


Link to post
Share on other sites

Release frontpaged on the Armaholic homepage.

cool thanks!

---------- Post added at 05:56 PM ---------- Previous post was at 05:45 PM ----------

This is really nice looking, but that infinite for loop in your code is quite nasty! Have you tried messing around with a CBA per frame handler type system for this? That would allow you to negate script lag and execute your code inside of a non-scheduled environment.

The system allows you to execute code every single frame (pre-frame render). I think you could get a HUGE performance increase.

Careful though, as it is blocking, if the code is too intense it can start to effect frame rate.

Didn't know about these features and details. Sounds great. I'm pretty new to Arma2 editing. But if someone wants to try this they are free to do so. I just updated the original post to make this clearer.

Also, while this would be a draw back to how it looks over all, using static lengths of rope between the nodes would be better network performance.

I think I don't understand what you mean. All the nodes are likely to be in motion all the time. Unfortunately I hardly know anything about network synchronization of objects in Arma2.

The distance between the nodes is being restricted. There is a part in the update loop forcing the nodes into their intended distances. Without this they would bounce around like on a rubber band.

Another option would be to locally create all the rope objects and have the script running on every client that needs it. That way nothing new is really sent over the network besides when to start and stop the simulation of the rope. You would have to devise some sort of alternate attaching object though, as I am not sure how attachTo works when a global object is attached to a locally created one.

One would also have to make sure that the simulations don't drift apart somehow, if it is required for the intended purpose. I guess this might be quite complicated. Maybe synchronize every now and then.

---------- Post added at 06:04 PM ---------- Previous post was at 05:56 PM ----------

cool addon, and a great need fullfilled, one question and pardon my ignorance:

is it at all possible to make this in script form, not a addon?

Im asuming no, but asking just in case.

I just updated the original post. Everyone is free to use the whole or parts from this release and re-release etc.

You can just use the scripts. But you will have to change the instantiation script to create node objects of the type you want. It currently creates the objects in the HEDU_Rope.pbo.

These objects have animations that are used to update the visible length of the rope. There is also the source files included in the package and information in the scripts about how the visual length of the rope is updated with animations.

You can also exchange the node objects at runtime with your own objects and just keep the original objects around. E.g. you can replace single nodes by barrels or something. But mind that objects that have gravity applied by the game engine behave bad. On the 'positive side' Arma2 will not give an error if the object you use for your nodes does not have the animation. You can also specify the animation name. All the details are in HEDU_Rope.hpp.

Share this post


Link to post
Share on other sites
I've been trying to use other addons like Norrin's fastrope and RAV lifter to use ropes in my support assets scripts, but they always look clunky being rigid all the time. A couple questions along those lines...

Would you ever consider adding animations to the addon so that someone can look like they're fastroping? (Something like Norrin's)

Unfortunately I don't intend to enhance this release now. Please read the original post, I've added information about 'copyright' etc., so you could just add these features yourself.

And do you know if using multiple ropes attached to the same object (i.e. lifting and carrying a humvee at four corners) would work just as well to have a load sway around. (Something like RAV lifter)

Sounds interesting. Never tried it. But I think it will not work right away. I believe you would have to update orientation of the attached object based on the four attachment points. And also invest some more to bind the 4 node ends to the 4 positions on the load. Haven't really thought it through though.

---------- Post added at 06:18 PM ---------- Previous post was at 06:12 PM ----------

Could something similar be used for articulated lorries ?

I think the rope is not really suitable for this because the node joints can rotate freely in all directions. You would have to use different joint constraints for this.

There is an aircraft tractor addon that might already provide that functionality.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×