Hello,
I am toying around with a gameplay mechanic and am not sure how to proceed. The goal is to have the player carry around a spear with a rope attached. When the player throws the spear it would stick to the environment then, if the spear is high enough and positioned correctly, the player can swing. This can be used to cross rivers, chasms, things like that. I followed some video tutorials and presently have a coconut you can throw that sticks to the environment:
http://www.nutrigames.com/experiment/
The coconut is a rigidbody and I got it to stick by creating a fixed joint on collision and turning it into a Kinematic rigidbody. (Basically took code from this forum).
I am not sure how to proceed at this point. Should I start by attaching the rope? What should I use for the rope? How could I make the camera “attach” to the rope and swing, perhaps with the arrow keys to generate momentum?
Also, if you try the link, you’ll notice the speed of the throw is determined by how long you hold down the left mouse button (it throws on releasing the button). The speed at which the strength changes varies greatly per computer. How do I normalize the changing speed so it’s consistent on all but extremely slow systems? Here is how I’m doing it now:
if (Input.GetButton("Fire1")) {
//Alter the throw force
if (throwForce >= maxThrowForce || throwForce < minThrowForce) {
throwForceIncrement *= -1;
}
throwForce += throwForceIncrement;
}
Thanks in advance!