Difference between revisions of "API Mouse.GetPosition"
From Flowcode Help
Jump to navigationJump to search (XML import API auto-gen) |
|||
(14 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
− | Gets the position of the mouse, intersecting with a component or the viewing plane | + | |- |
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetPosition''' | ||
+ | |- | ||
+ | | colspan="2" | Gets the position of the mouse, intersecting with a component or the viewing plane | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-h32-icon.png]] - HANDLE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | == | + | ==Detailed description== |
− | + | This returns a position object, with the Z axis being a ray from the eye plane (intersecting the mouse) into the screen, and the coordinates being the intersection point of a component under the mouse. If no component under the mouse the ray intersection is the cameras target plane. | |
− | + | [[File:SIMAPI Mouse.GetPosition Projection.svg|thumb|none|The mouse projection]] | |
− | [[ | + | To calculate the mouse position a ray is projected into the screen. The first (i.e. nearest) ''solid'' object intersected by the mouse is considered to be the object under the mouse. |
− | + | If the ray intersects the back plane before any other object, the distance along the ray from the eye is the same as the distance from the eye to the target. | |
− | |||
− | |||
− | + | ==Examples== | |
− | + | ===Calling in a calculation=== | |
* Declare a variable 'result' of type HANDLE | * Declare a variable 'result' of type HANDLE | ||
− | * Add to a calculation icon: result = ::Mouse.GetPosition() | + | * Add to a calculation icon: <pre class="brush:[cpp]">result = ::Mouse.GetPosition()</pre> |
Latest revision as of 11:55, 16 January 2023
![]() |
GetPosition |
Gets the position of the mouse, intersecting with a component or the viewing plane | |
![]() |
Return |
Detailed description
This returns a position object, with the Z axis being a ray from the eye plane (intersecting the mouse) into the screen, and the coordinates being the intersection point of a component under the mouse. If no component under the mouse the ray intersection is the cameras target plane.
To calculate the mouse position a ray is projected into the screen. The first (i.e. nearest) solid object intersected by the mouse is considered to be the object under the mouse.
If the ray intersects the back plane before any other object, the distance along the ray from the eye is the same as the distance from the eye to the target.
Examples
Calling in a calculation
- Declare a variable 'result' of type HANDLE
- Add to a calculation icon:
result = ::Mouse.GetPosition()