PushPullObject Script

The PushPullObject script provides functionality for objects that can be pushed and pulled by the player within the game environment. It handles ground detection, collision detection, and event trigge

debug: Enables debug mode to receive console reports.

player: Reference to the player's transform variable.

playerTag: Tag used to identify the player (Unity Tag-System).

playerACTag: Tag used to identify the player (Malbers Tag-System).

rotateMode: Enable rotation mode for the object

useKinematicState: Toggle to make the object unaffected by external forces like explosions.

freezePosition: Prevent the push-pull object from sliding down slopes while in push-pull state.

delaySetKinematic: Delay in seconds before the collider stops registering as grounded and applies kinematic settings if grounded.

Detection Settings

raycastDistance: Distance of the raycast used to detect ground and moving platforms.

movingPlatformTag: Tag used to identify moving platforms (Unity Tag-System).

movingPlatformACTag: Tag used to identify moving platforms (Malbers Tag-System).

groundThreshold: Vertical distance threshold to determine when the object is considered grounded.

slopeThresholdAngle: Angle limit to distinguish flat ground from sloped surfaces.

Event Section

positionCollision: Represents the initial collision position when the object collides.

positionOnLanding: Represents the initial collision position when the object lands.

positionBottom: Denotes a position located underneath the object, suitable for particle effects beneath the object.

positionBottomOffset: Allows adjustment of the vertical offset for the bottom position as needed.

movementThreshold: Movement threshold value. Events trigger based on this threshold.

useRigidbodyVelocity: When enabled, triggers the 'OnMoving' event if the object's velocity exceeds the specified threshold.

rigidbodyVelocity: Specifies the velocity threshold for triggering the 'OnMoving' event.

OnObjectMove: Event triggered when the object's movement input is above the movement threshold.

OnObjectStop: Event triggered when the object's movement input is below the movement threshold.

OnLanding: Event triggered when the object becomes grounded.

OnCollision: Event triggered when the object collides.

Movement Block Settings:

The movement gets blocked in the direction where the collision occurred.

restrictMovement: Can be used to restrict movement. For example, in a 2D scenario, you can block the unused movements.

Public Methods:

Last updated