Jump to content

API Mouse.GetPosition: Difference between revisions

From Flowcode Help
Admin (talk | contribs)
XML import of API auto-gen
 
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
 
(20 intermediate revisions by 4 users not shown)
Line 1: Line 1:
wiki page name
{| class="mtx-class-macrotable wikitable"
==MouseGetPosition==
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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''
|}


Gets the position of the mouse, intersecting with a component or the viewing plane
----


===Parameters===
==Detailed description==
''This function has no parameters''
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.


===Return value===
[[File:SIMAPI Mouse.GetPosition Projection.svg|thumb|none|The mouse projection]]
[[Variable types|HANDLE]]
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.


Returns the position of the mouse, intersecting with a component or the viewing plane
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.


===Detailed description===
''No additional information''


===Examples===
==Examples==
====Calling in a calculation:====
===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 14:11, 13 July 2026

GetPosition
Gets the position of the mouse, intersecting with a component or the viewing plane 
- HANDLE 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.

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
  • Add to a calculation icon:
    result = ::Mouse.GetPosition()