Difference between revisions of "API Mouse.GetPosition"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<sidebar>API contents</sidebar>
+
{| 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&nbsp;
 +
|-
 +
|-
 +
| 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''
 +
|}
  
<div style="width:25%; float:right" class="toc">
 
====Class hierarchy====
 
[[API Mouse|Mouse]]
 
:[[API Mouse|GetPosition]]
 
</div>
 
__TOC__
 
  
==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==
 
[[Variable types|HANDLE]]
 
  
Returns the position of the mouse, intersecting with a component or the viewing 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.
  
==Detailed description==
+
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.
''<span style="color:red;">No additional information</span>''
 
  
  
Line 25: Line 25:
 
* Declare a variable 'result' of type HANDLE
 
* Declare a variable 'result' of type HANDLE
 
* Add to a calculation icon: <pre class="brush:[cpp]">result = ::Mouse.GetPosition()</pre>
 
* Add to a calculation icon: <pre class="brush:[cpp]">result = ::Mouse.GetPosition()</pre>
 
''<span style="color:red;">No additional information</span>''
 

Latest revision as of 11:55, 16 January 2023

Fc9-comp-macro.png GetPosition
Gets the position of the mouse, intersecting with a component or the viewing plane 
Fc9-h32-icon.png - 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.

Error creating thumbnail: sh: convert: command not found
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()