This question was
closed Feb 04, 2017 at 04:54 PM by
HenryStrattonFW for the following reason:
Duplicate question. http://answers.unity3d.com/questions/1308689/i-updated-my-unity-5-and-now-getting-errors.html
Question by
mike1233 · Feb 04, 2017 at 02:40 PM ·
scripting problem2d gameunityeditorrigidbody2d
2d rigibody error?
the game is 2d so why is error asking about rigidbody 2d its definitely a 2d game
error is Assets/Standard Assets/Scripts/General Scripts/DragRigidbody.js(30,18): BCE0019: 'rigidbody2D' is not a member of 'UnityEngine.RaycastHit'. Did you mean 'rigidbody'?
if (!springJoint)
{
var go = new GameObject("Rigidbody2D dragger");
35. var body : Rigidbody2D = go.AddComponent.<Rigidbody2D>() as Rigidbody2D;
springJoint = go.AddComponent.<SpringJoint>();
body.isKinematic = true;
}
40. springJoint.transform.position = hit.point;
if (attachToCenterOfMass)
{
var anchor = transform.TransformDirection(hit.rigidbody2D.centerOfMass) + hit.rigidbody2D.transform.position;
anchor = springJoint.transform.InverseTransformPoint(anchor);
45. springJoint.anchor = anchor;
}
else
{
springJoint.anchor = Vector3.zero;
50. }
springJoint.spring = spring;
springJoint.damper = damper;
springJoint.maxDistance = distance;
55. springJoint.connectedBody = hit.rigidbody2D;
Comment
Answer by HenryStrattonFW · Feb 04, 2017 at 04:50 PM
Moving answer to duplicate question. http://answers.unity3d.com/questions/1308689/i-updated-my-unity-5-and-now-getting-errors.html