First Person Controller API

Modified on Sun, 27 Jun 2021 at 07:36 PM

The following properties and methods are exposed by the Voxel Play First Person Controller component.


You can access these methods through VoxelPlayFirstPersonController.instance.xxx.


Common methods and properties:


public void SetOrbitMode(state)
Switches from free camera move to orbit mode. In orbit mode, you can set a target position and minimum/maximum distance to the target. The camera will orbit/rotate around the target. This mode is used in demo scene 1 "Colorizer" when the camera moves away from the cube - as it approaches the cube it switches gently to free mode.


crosshairOnBlock
True if the crosshair is on a reachable voxel (defined by the hit range property in the Player component).


crosshairHitInfo

Additional info on the voxel currently on the crosshair.



Useful events:

public event VoxelEvent OnVoxelEnter;

Triggered when player enters a voxel if that voxel definition has triggerEnterEvent = true


public event VoxelEvent OnVoxelWalk;

Triggered when a player walks over a voxel if that voxel definition has triggerWalkEvent = true


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article