Difference between revisions of "API Panel.Position.MoveBy"

From Flowcode Help
Jump to navigationJump to search
(XML import of API auto-gen)
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<sidebar>API contents</sidebar>
+
<sidebar>API Contents</sidebar>
 
Moves the object by the given offset relative to its parent
 
Moves the object by the given offset relative to its parent
  
 +
<div style="width:25%; float:right" class="toc">
 +
====Class hierarchy====
 +
[[API Panel|Panel]]
 +
:[[API Panel.Position|Position]]
 +
::[[API Panel.Position|MoveBy]]
 +
</div>
 +
__TOC__
  
===Parameters===
+
==Parameters==
''[[Variable types|HANDLE]] Handle''
+
[[Variable Types|HANDLE]] ''Handle''
 
:The position or component to update
 
:The position or component to update
 
:''The default value for this parameter is: '''''this'''
 
:''The default value for this parameter is: '''''this'''
  
''[[Variable types|FLOAT]] X''
+
[[Variable Types|FLOAT]] ''X''
 
:Local coordinate X to increment by
 
:Local coordinate X to increment by
 
:''The default value for this parameter is: '''''0'''
 
:''The default value for this parameter is: '''''0'''
  
''[[Variable types|FLOAT]] Y''
+
[[Variable Types|FLOAT]] ''Y''
 
:Local coordinate Y to increment by
 
:Local coordinate Y to increment by
 
:''The default value for this parameter is: '''''0'''
 
:''The default value for this parameter is: '''''0'''
  
''[[Variable types|FLOAT]] Z''
+
[[Variable Types|FLOAT]] ''Z''
 
:Local coordinate Z to increment by
 
:Local coordinate Z to increment by
 
:''The default value for this parameter is: '''''0'''
 
:''The default value for this parameter is: '''''0'''
  
===Return value===
+
 
 +
==Return value==
 
''This call does not return a value''
 
''This call does not return a value''
  
===Detailed description===
 
''No additional information''
 
  
===Examples===
+
==Detailed description==
====Calling in a calculation====
+
This moves the position in its own axis by ''X'', ''Y'' and ''Z'' units. That is, the center of the ''Handle'' object is considered to be (0, 0, 0).
* Add to a calculation icon: <pre class="brush:[C]">::Panel.Position.MoveBy(handle, x, y, z)</pre>
+
 
 +
 
 +
It is a simpler version of [[API Panel.Position.MoveAlong|MoveAlong]] and a compliment to [[API Panel.Position.MoveTo|MoveTo]].
 +
 
 +
 
 +
==Examples==
 +
===Calling in a calculation===
 +
* Add to a calculation icon: <pre class="brush:[cpp]">::Panel.Position.MoveBy(handle, x, y, z)</pre>
 +
 
 +
===Flowcode example file===
 +
Download {{Fcfile|SIMAPI_Panel_Position_MoveBy.fcfx|SIMAPI_Panel_Position_MoveBy}} and open it in Flowcode v6. In this example, there are three cubiods that represent Axis X,Y,Z. Note they are coloured exactly as the panel axis indicator which represents your viewing position. There is a sphere also on the panel.
 +
 
 +
The MoveBy(h,x,y,z) function moves an object from it's original coordinates by a set value represented as an offset from it's original coordinate. In this example, the sphere's original coordinates are x10,y10,z0. The program loops 4 times, each time it calls the MoveBy function increasing the x & y coordinates by 20. This moves the sphere diagonally. As each loop passes the new coordinates would be as follows:
 +
 
 +
# Original Position = (x10,y10,z0), MoveBy(x20,y20,z0), New position = (x30,y30,z0)
 +
# Original Position = (x30,y30,z0), MoveBy(x20,y20,z0), New position = (x50,y50,z0)
 +
# Original Position = (x50,y50,z0), MoveBy(x20,y20,z0), New position = (x70,y70,z0)
 +
# Original Position = (x70,y70,z0), MoveBy(x20,y20,z0), New position = (x90,y90,z0)
 +
 +
After each loop the program pauses a second to allow you to see the effect of the function.
 +
 
 +
The screenshots below show the effect and also highlight the code used by the example.
 +
 
 +
[[File:SIMAPI_Panel_Position_MoveBy_Pic1.png]][[File:SIMAPI_Panel_Position_MoveBy_Pic2.png]][[File:SIMAPI_Panel_Position_MoveBy_Pic3.png]][[File:SIMAPI_Panel_Position_MoveBy_Pic4.png]]
 +
 
 +
[[File:SIMAPI_Panel_Position_MoveBy_Pic0.png]]
 +
 
 +
===Moving a panel item===
 +
 
 +
Simple example showing how to detect for collisions between objects on the panel. An object moves back and forth between two fixed objects. Each time the moving object hits a static object it will change it's direction.
 +
 
 +
{{Fcfile|Collide.fcfx|Collide}}

Latest revision as of 15:15, 11 May 2016

<sidebar>API Contents</sidebar> Moves the object by the given offset relative to its parent

Class hierarchy

Panel

Position
MoveBy

Parameters

HANDLE Handle

The position or component to update
The default value for this parameter is: this

FLOAT X

Local coordinate X to increment by
The default value for this parameter is: 0

FLOAT Y

Local coordinate Y to increment by
The default value for this parameter is: 0

FLOAT Z

Local coordinate Z to increment by
The default value for this parameter is: 0


Return value

This call does not return a value


Detailed description

This moves the position in its own axis by X, Y and Z units. That is, the center of the Handle object is considered to be (0, 0, 0).


It is a simpler version of MoveAlong and a compliment to MoveTo.


Examples

Calling in a calculation

  • Add to a calculation icon:
    ::Panel.Position.MoveBy(handle, x, y, z)

Flowcode example file

Download FC6 Icon.png SIMAPI_Panel_Position_MoveBy and open it in Flowcode v6. In this example, there are three cubiods that represent Axis X,Y,Z. Note they are coloured exactly as the panel axis indicator which represents your viewing position. There is a sphere also on the panel.

The MoveBy(h,x,y,z) function moves an object from it's original coordinates by a set value represented as an offset from it's original coordinate. In this example, the sphere's original coordinates are x10,y10,z0. The program loops 4 times, each time it calls the MoveBy function increasing the x & y coordinates by 20. This moves the sphere diagonally. As each loop passes the new coordinates would be as follows:

  1. Original Position = (x10,y10,z0), MoveBy(x20,y20,z0), New position = (x30,y30,z0)
  2. Original Position = (x30,y30,z0), MoveBy(x20,y20,z0), New position = (x50,y50,z0)
  3. Original Position = (x50,y50,z0), MoveBy(x20,y20,z0), New position = (x70,y70,z0)
  4. Original Position = (x70,y70,z0), MoveBy(x20,y20,z0), New position = (x90,y90,z0)

After each loop the program pauses a second to allow you to see the effect of the function.

The screenshots below show the effect and also highlight the code used by the example.

SIMAPI Panel Position MoveBy Pic1.pngSIMAPI Panel Position MoveBy Pic2.pngSIMAPI Panel Position MoveBy Pic3.pngSIMAPI Panel Position MoveBy Pic4.png

SIMAPI Panel Position MoveBy Pic0.png

Moving a panel item

Simple example showing how to detect for collisions between objects on the panel. An object moves back and forth between two fixed objects. Each time the moving object hits a static object it will change it's direction.

FC6 Icon.png Collide