# 3D collision

Check collision and distance between 3D objects.

Authors and contributors to this community extension: D8H, TulenvakiProductions.

Warning

This is an extension made by a community member — but not reviewed by the GDevelop extension team. As such, we can't guarantee it meets all the quality standards of official extensions. In case of doubt, contact the author to know more about what the extension does or inspect its content before using it.

Check collision and distance between 3D objects and separate them from each other.

Tip

Learn how to install new extensions by following a step-by-step guide.

## Actions

Separate objects in 3D
Move an object away from another using their collision masks. Object rotation around X and Y axes are ignored.
Be sure to call this action on a reasonable number of objects to avoid slowing down the game.

## Conditions

Collision in 3D
Check the collision between two objects using their collision masks. Object rotation around X and Y axes are ignored.

Distance between two objects in 3D
Compare the distance between two objects in 3D.

Pick nearest object in 3D
Pick the object of this type that is nearest to the specified position in 3D.

## Expressions

Expression Description
`Collision3D::Distance(object, object)` Distance between two objects in 3D.
👾 Object Object
👾 Object Other object
`Collision3D::DistanceToPosition(object, number, number, number)` Distance between an object and a position in 3D.
👾 Object Object
🔢 Number X position
🔢 Number Y position
🔢 Number Z position
`Collision3D::SqDistance(object, object)` Square distance between two objects in 3D.
👾 Object Object
👾 Object Other object
`Collision3D::SqDistanceToPosition(object, number, number, number)` Square distance between an object and a position in 3D.
👾 Object Object
🔢 Number X position
🔢 Number Y position
🔢 Number Z position