Hyorange
4 years agoExplorer
Interaction SDK : Get click world position ?
Hello. I'm trying to use the Interaction SDK. I have a quite simple scene with a Canvas and a Plane (floor). Thanks to the Interaction SDK, I can use my hands to interact with the Canvas. That part ...
- 4 years ago
Answering my own question if someone ever needs it :
- Add Ray Interactable and Pointable Plane to the plane
- Ray Interactable : Pointable Element : leave empty. Collider : drop the plane collider component. Surface : drop the Pointable Plane component. Now you should be able to see your cursor on the plane with your hands. If you see it above your plane, scale down your plane on Y axis.
- Now to get the cursor position, you can take it from the RayInteractor. In my case, I took it from HandRayInteractor:
- Link this to your script with
public RayInteractor rayInteractor;
- Now you can get the cursor position on your plane with
Vector3 cursorPosition = rayInteractor.CollisionInfo.Value.Point;
- Add Ray Interactable and Pointable Plane to the plane