Clip planes hide the geometry on one side of a user-defined plane to reveal the interior of a 3D model.
There are two main aspects to support clipping in Unreal Engine. Each clip plane has an associated clip plane actor, which is responsible for the visual elements of the plane itself (e.g. grid, arrow). The actual clipping is implemented in the geometry materials (see /Content/instant3Dhub/Internal/Materials/MF_I3DHClipPlaneOpacity).
You can override which class is used for the clip plane actors using AI3DHConnector::ClipPlaneActorClass. Note that the FI3DHClipPlaneAPI manages the lifecycle and the "Hidden In Game" state of the clip plane actors; the application should not spawn / destroy clip plane actors or change the "Hidden In Game" state of the actors manually.
Currently, the transformation of the clip plane actors is the source of truth for each clip plane. To change a clip plane it is sufficient to set a new transformation on the clip plane actor and the change will automatically be synced to other clients in the session (note also that the transformation of an actor might be changed by the FI3DHClipPlaneAPI, to reflect changes made by other clients).
The plugin supports a maximum of 8 clip planes. Additional clip planes can be created via the API, but they will not affect the geometry (and no corresponding clip plane actor will be spawned).
◆ ChangeClipPlane()
Changes one or more properties of the clip plane with the specified ID.
- Parameters
-
ClipPlaneId | The ID of the clip plane to change. |
Properties | New properties. Unset properties keep their value. |
OnComplete | Callback called on completion. |
◆ ClipLineSegmentByClipPlanes()
static bool UI3DHUtilities::ClipLineSegmentByClipPlanes |
( |
AI3DHConnector * | HubConnector, |
|
|
FVector & | Start, |
|
|
FVector & | End ) |
|
static |
Clip a line segment to the positive half space (the side with the normal pointing upwards) of all ClipPlanes (if any).
- Parameters
-
HubConnector | The hub connector used to retrieve all ClipPlanes. |
Start | Start location of the line segment. |
End | End location of the line segment. |
- Returns
- False if the LineSegment is completely clipped. True otherwise.
- See also
- FI3DHClipPlaneAPI::GetClipPlanes
◆ ClipLineSegmentByMainClipPlane()
static bool UI3DHUtilities::ClipLineSegmentByMainClipPlane |
( |
AI3DHConnector * | HubConnector, |
|
|
FVector & | Start, |
|
|
FVector & | End ) |
|
static |
Clip a line segment to the positive half space (the side with the normal pointing upwards) of the Main ClipPlane (if any).
- Parameters
-
HubConnector | The hub connector used to retrieve the Main ClipPlane. |
Start | Start location of the line segment. |
End | End location of the line segment. |
- Returns
- False if the LineSegment is completely clipped. True otherwise.
- See also
- FI3DHClipPlaneAPI::GetMainClipPlaneActor
◆ ClipLineSegmentByPlane()
static bool UI3DHUtilities::ClipLineSegmentByPlane |
( |
FVector & | Start, |
|
|
FVector & | End, |
|
|
const FPlane & | Plane ) |
|
static |
Clip a line segment to the positive half space (the side with the normal pointing upwards) of a plane.
- Parameters
-
Start | Start location of the line segment. |
End | End location of the line segment. |
Plane | The plane to clip the line against. |
- Returns
- False if the LineSegment lies completely inside the negative half space.
- See also
- MakePlaneFromClipPlaneActor
◆ CreateClipPlane()
Creates a new clip plane.
- Parameters
-
Properties | Properties of the new clip plane. |
OnComplete | Callback called on completion. |
◆ DisableMainClipPlane()
Disables the main clip plane.
- Parameters
-
OnComplete | Async callback. |
◆ EnableMainClipPlane()
Enables the main clip plane.
- Parameters
-
OnComplete | Async callback. |
◆ FindClipPlaneActor() [1/2]
AActor * AI3DHConnector::FindClipPlaneActor |
( |
int32 | ClipPlaneId | ) |
|
Gets clip plane actor for a specific clip plane.
- Note
- Must be called from the game thread.
- Returns
- The ClipPlane Actor if there is one, otherwise nullptr.
◆ FindClipPlaneActor() [2/2]
virtual AActor * FI3DHClipPlaneAPI::FindClipPlaneActor |
( |
int32 | ClipPlaneId | ) |
|
|
pure virtual |
Gets clip plane actor for a specific clip plane.
- Note
- Must be called from the game thread.
-
Can return nullptr, even if the ClipPlaneId is valid, if the clip plane rendering limit of the plugin has been reached.
- Returns
- The ClipPlane Actor if there is one, otherwise nullptr.
◆ GetClipPlaneProperties()
Retrieves the properties of a clip plane.
- Parameters
-
ClipPlaneId | The ID of the clip plane. |
OnComplete | Callback called on completion. |
◆ GetClipPlanes() [1/2]
TArray< int32 > AI3DHConnector::GetClipPlanes |
( |
| ) |
|
Returns the IDs of the currently existing clip planes.
- Note
- Must be called from the game thread.
◆ GetClipPlanes() [2/2]
virtual TArray< int32 > FI3DHClipPlaneAPI::GetClipPlanes |
( |
| ) |
|
|
pure virtual |
Returns the IDs of the currently existing clip planes.
- Note
- Must be called from the game thread.
◆ GetMainClipPlaneActor() [1/2]
AActor * AI3DHConnector::GetMainClipPlaneActor |
( |
| ) |
|
Gets the main clip plane actor.
- Returns
- The ClipPlane Actor if there is one, otherwise nullptr.
◆ GetMainClipPlaneActor() [2/2]
virtual AActor * FI3DHClipPlaneAPI::GetMainClipPlaneActor |
( |
| ) |
|
|
pure virtual |
Gets main clip plane actor.
- Returns
- The ClipPlane Actor if there is one, otherwise nullptr.
◆ MakePlaneFromClipPlaneActor()
static FPlane UI3DHUtilities::MakePlaneFromClipPlaneActor |
( |
const AActor * | ClipPlaneActor | ) |
|
|
static |
Makes a plane structure from the clip plane actor with its world space location as plane origin and its world space up-vector as plane normal.
- Parameters
-
ClipPlaneActor | The clip plane actor (must not be null). |
- Returns
- The plane structure of the clip actor.
- See also
- FI3DHClipPlaneAPI::FindClipPlaneActor
◆ RemoveClipPlane()
Removes a clip plane.
- Parameters
-
ClipPlaneId | The ID of the clip plane. |
OnComplete | Callback called on completion. |
◆ ClipPlaneActorClass
Actor class used to render a clip plane.
Parts in local -z direction of the actor will be clipped.