Hi Guys,
I have two objects, that both need to move to physics realistically. Object ‘A’ needs to bounce off object ‘B’, without object ‘B’ having their physics changed.
I’ve tried stopping the velocity change in OnCollisionEnter(), but it looks like that’s called after the physics update on the collision itself and there’s no reference to the change in physics OnCollisionEnter().
It looks like my only option is to set object ‘B’ as kinematic and create the physics myself. I’ve had a look around google for a few hours, but can’t find any clean explanation on how to create physics movement.
I’m thinking of creating something like this:
Vector3 velocity = new Vector3(0,0,0);
Vector3 gravity = new Vector3(0,-4.98f,0)
Vector3 externalForces = new Vector3(0,0,0);
void FixedUpdate()
{
externalForces += gravity + anythingElse;
velocity += externalForces;
rigidbody2D.MovePosition(transform.position + velocity * Time.deltaTime);
}
but will be losing the smooth movement of the physics engine? Also asides drag and mass, is there anything that needs to be accounted for?