News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Grapple beam: How do it work?

Started by Swagger, May 17, 2014, 03:30:11 PM

Previous topic - Next topic

Swagger

How the hell does the grapple beam work mathematically? If anyone can show me a commented subroutine or a step by step procedure for how its movement is done, i'd be very grapeful.

RT-55J

SM's grapple beam is pretty buggy and likely a bunch of spaghetti code. I don't think it would be a good idea to copy it directly.

I'd probably recommend using "simple pendulum" model for your grappling beam, and see if you can mess around with that equation to get something workable out of it. Anything beyond that would require a knowledge of physics and mathematics currently above my head.

craighypheno

Arrggghhhh I remember doing this in my mathematics degree. There are several ways you can use these equations to do many things with but I cannot remember all the details regarding it.

Basically it is a second order differential equation which uses displacement, movement and acceleration, so all of these things are considered. You also need to know that theta (the weird 0 with a line through it - Greek letter) will be measured in RADIANS if you are using any calculator to work out the angle. In most cases, g is taken to be approximately 9.8ms^-2 (that's metres per second, per second - acceleration).

I know naff all about the grapple beam except it fries fishies and bugs, but I know a little bit about maths. Hopes this helps.

Swagger

I don't need none of that, all the variables I got is xVel, yVel, Length, Angle, HookX, HookY, Gravity, and that's it.

There's gotta be some way.

Smiley

If you have the length, angle and the hook's position, you can calculate the player's position with simple trigonometry.
You should know how sine and cosine work. (Hint: cos(angle)=x, sin(angle)=y)

Hope this helps.

craighypheno

SMILEUser hit the nail on the head really. Like I said I don't know much about using Grapple but I know some mathsy things.