- Home /
Creating a rope from C# that attaches to a tag and lets you swing from it?
I've decided to try my hand at learning a few newer things, I've created a player script with movement, sprinting and learned how to use Mecanim but now I'd like to go one better, I've looked around but I can't find any tutorials on this, is there any help I could get without spoon feeding me the answers directly?
I'd basically like Q&E to shoot ropes at a specific angle and attach to any items with the tag (Wall) and stay hooked until you let go, at the same time allowing you to swing from them and automatically reel in?
This is a bunch of things and a bunch of ways to do it. Pick one and start. Rope could be a model or lineRenderer (is it 2D or 3D.) Raycasting and then checking a tag is common for lots of stuff. Swing can use physics and a hinge, or just math. The shoot/reelIn animation could probably be done lots of ways.
Owen hit it spot on. It'd be better to ask for specifics when you hit a wall because there's so many methods in achieving this.
I'll second what Owen said. There's so much more you'll need to define before a specific answer can be supplied.
I'd suggest that if you're new to program$$anonymous$$g and/or Unity, that you start with the basics, and master those. And by that, I mean master. There's also plenty of tutorials online covering just about every problem. That's one of the really great things about Unity. For example, this page talks you through the use on HingeJoint2D, which sounds pretty much like what you might be looking for to get the "rope" dynamic working, for starters.
Thanks everyone, I guess I'd prefer using Raycast + Line Rendering, but would it be possible to use this and make it feel as if a rope is being shot without spawning the line renderer straight away on keypress?
$$anonymous$$ove the second point of the LineRenderer rope that is shot from close to the player to tagged object over time. You can use a Coroutine for this.
Your answer
Follow this Question
Related Questions
2D Platforme Rope 1 Answer
2D rope swing - Image explains all 1 Answer
How to get First person controller to swing on rope? 1 Answer
2D hinge joint with sprite 0 Answers
Attach to cloth Unity5 - How to pull cloth objects instead of push? 0 Answers