Question by
StuGuy · May 26, 2020 at 04:00 PM ·
mouserigidbody2dupdate2d-physicscollison
Hey, is there a way to have an object constantly keeping up with a mouse collision, as the mouse seems to fast for the update()
I've tried changing the mouse's rigid-body body type as well as using fixed/late update();
I'm trying to move a line controlled by the mouse to push an object, but as i get a little to fast it goes through the object as if update isn't running enough times per second to keep up.
void FixedUpdate()
{
if (Input.GetButton("Fire2"))
{
transform.position = newPos + (mouse.transform.position - oldPos);
} else
{
oldPos = mouse.transform.position;
newPos = transform.position;
}
lineDrag();
}
annotation-2020-05-24-180510.png
(62.0 kB)
Comment
Your answer
Follow this Question
Related Questions
2D Top-Down Character: How to make my character move using physics? 1 Answer
Why/How 2d tower of blocks collapse? 0 Answers
Unity 5.3 Collider2D not working 2 Answers
How to move rigidbodies with 2D Character controller (No rigidbody) 1 Answer
How can I slow the movement of a single rigidbody2D? 2 Answers