Setting Up the Object
Last updated
Last updated
Create the object you want to push and pull in your Unity scene. Make sure it has a collider attached to it.
Attach the PushPullObject script onto the object. This script will handle the push and pull collision and detection logic. A Rigidbody component will be automatically attached as well.
In the Inspector window, set up the variables of the PushPullObject script according to your requirements. Important: The player and one tag for the player needs to be set.
Ensure that the object has tags used to identify it. You can use either Unity's tag system or Malbers Tag-System for this purpose.