- Home /
Question by
andreas777 · Feb 16, 2014 at 09:54 PM ·
physicsfunction updatephysics 2d
Help me change the code to work with Physics 2D
Could anyone help me to change this code to work with Physics 2D because all of my game works with Physics 2D and this code doesn't but I'm not sure how to do it. It works fine with Physics but it doesn't work with Phyisics 2D and thats what I want.
Code:
private var ray : Ray;
private var rayCastHit : RaycastHit;
function Update()
{
if(Input.GetMouseButton(0))
{
ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, rayCastHit))
{
transform.position.y = rayCastHit.point.y;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
game hags with several Polygon Colliders on the scene 0 Answers
2D 360 degress platformer example needed 0 Answers
How to jump always with the same height 1 Answer
Rigidbody Gravity Too Slow 4 Answers
New Pointer Effector 2D Help 0 Answers