Hello, everything is on the title.
When I am right clicking on the editor view, I want to create a world object at the position I am clicking.
Yes, it work with a raycast:
Vector2 mousePos = Event.current.mousePosition;
RaycastHit _saveRaycastHit;
Ray worldRay = HandleUtility.GUIPointToWorldRay(mousePos);
if (Physics.Raycast(worldRay, out _saveRaycastHit, Mathf.Infinity))
{
if (_saveRaycastHit.collider.gameObject != null)
{
//_saveRaycastHit.point;
}
}
else
{
//here How can I extrapolate a position ?
}
Here if my raycast work, that mean i touch an object, then I can have the position, OK.
But if my raycast doen’t touch anything, I want to extrapolate a world position anyway.
How can I do that ?
Thanks !