Right now I have a gameobject that attaches to a player when they touch it, however I’m trying to make it connect right in front of them instead of wherever it initially touches them:
void OnCollisionEnter(Collision collision)
{
ContactPoint contact = collision.contacts[0];
Quaternion rot = Quaternion.FromToRotation(Vector3.up, contact.normal);
//Vector3 pos = contact.point; //(-2.5, 0.7, 13.1) is near ideal location
Vector3 pos = new Vector3(-2, 1, 13); //(-2.5, 0.7, 13.1) is near ideal location
var joint1 = collision.gameObject.AddComponent<FixedJoint> ();
joint1.connectedBody = transform.GetComponent<Rigidbody> ();
}
Is there a way to have it connect right in front of the player each time?
Thanks!