- Home /
Collisions while using Vector2.Lerp
Hi,
I was hoping that someone could point me in the right direction here. I have tried numerous approaches to find a solution for stopping my player object from moving through another object while using Vector2.Lerp. I recently found that finding out the contact point normals of the other object in the collision can tell me which way the player object should not be able to pass through. I was wondering if there was a function or something that I missed that would at least help ease the pain..
Does anybody have any insight to share?
Thanks in advance.
can you explain more in depth. If you are detecting using OnCollisionEnter or stay I don't understand the question, as it already tells you you've collided. If not, are you intending to compare meshes (super expensive)? why are you moving via vector2.lerp rather than by addforce? Lerping and not using built-in collision detection confuses me. How exact are you intending your collision to be - does it need to be that precise, i mean are you doing a science application for a NASA $$anonymous$$oon landing or an 8-bit 2d scroller?
I need my movement to be super precise because the player object needs to pick up objects and place them on top of other objects. Lets say each object has a piece of a picture and by placing the objects on top and beside one another completes the picture, so precision counts when moving and this is why I'm using Vector3.Lerp with iskinematic rigid bodies rather than rigid bodies with non kinematic checked because it's near impossible to get precise movement with rigid bodies.
On the other hand, detecting collisions and stopping movement in only one direction has been very difficult to figure out. $$anonymous$$y player object has to weave through obstacles to make it to different locations and when it hits something, I don't want it to stop, but I just want it to stop movement in that direction.
Anyways, I think I'm going to try non kinematic rigid body with addforce until the player object gets close enough to the desired location and then I will switch to iskinematic and Lerp. It should work.... I'm hoping... I better hurry, NASA is counting on me for this 8 bit scroller!!
Your answer
Follow this Question
Related Questions
Limit Lerp Distance From Target 1 Answer
How to get click position in Vector 2 ? 1 Answer
I'm Having Trouble With Vector3.Reflect.. Please Help? 1 Answer
Why doesnt Vector2.Lerp work? 1 Answer