While im moving my cube is jittery and when I touch another collider it bounces
how can I prevent this?

For moving my cube I use moveposition(and lerping )
void FixedUpdate()
{
if(objectGrabPointTransform != null)
{
Vector3 newPosition = Vector3.Lerp(transform.position, objectGrabPointTransform.position, Time.deltaTime * lerpSpeed);
objectRigidbody.MovePosition(newPosition);
}
}
is this my culprit? the movepos function?
if so how can i fix it?
should I use velocity instead? if so, how? (I never used it)
You could try changing it to Update(), this would increase the speed in which it updates. But personally, I believe the jittering is due to how you are using Lerp. Its easier to understand if I break down what each parameter means…
- The Start position
- The End position
- A number between 0 and 1 where 0 is the start position and 1 is the end position
If you want to use lerp, you need to store the old and new position in a variable and another variable which will increase by your lerpSpeed everytime FixedUpdate() runs. Not tested it, but I believe this should work;
private Vector3 lerpStart = Vector.zero;
private Vector3 lerpEnd = Vector.zero;
private float lerpTime = 0f;
private void FixedUpdate()
{
lerpTime += lerpSpeed;
if(objectGrabPointTransform != null)
{
Vector3 newPosition = Vector3.Lerp(lerpStart, lerpEnd, lerpSpeed);
objectRigidbody.MovePosition(newPosition);
if(objectGrabPointTransform.position != lerpEnd)
{
lerpStart = transform.position;
lerpEnd = objectGrabPointTransform.position;
lerpTime = 0f
}
}
}
And in regards to your object going through other colliders, that’s a very well known unity querk. Best to look that one up on Google…
https://forum.unity.com/threads/what-are-the-necessary-settings-to-prevent-objects-passing-through-each-other-at-high-speeds.384519/