- Home /
Help with grab and swing
Hello! I have made my character grab on things using freeze position and hinge joints but it is really jerky and he looks like his hands are getting ripped off, also i would like to be able to move around the locked hand while grabbing on something, unfortunetly i can only move a little bit, it feels like the character is really heavy. I have tried lowering his mass and tweaking the gravity but the result is the same. Any tips on how i can do this work properly? P.S: I just got started don't laugh at my learning project :c
This seems like you need a longer discussion around the topic of grabbing a ledge. I suggest using Unity Forums ins$$anonymous$$d. If you want to specifically ask about your implementation please provide a code snipppet of what you have currently tried.
I have attached this to the black dots at the end of the arms
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GrabR : $$anonymous$$onoBehaviour
{
public bool isTouching;
public Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
if (Input.Get$$anonymous$$ouseButton(1) && isTouching == true)
{ rb.constraints = RigidbodyConstraints2D.FreezePosition; }
else rb.constraints = RigidbodyConstraints2D.None;
}
public void OnCollisionEnter2D(Collision2D collision)
{
isTouching = true;
}
public void OnCollisionExit2D(Collision2D collision)
{
isTouching = false;
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612195140im_/https://answers.unity.com/themes/thub/images/avi.jpg)