Component:SnapSphere: Difference between revisions

From Resonite Wiki
remove stub
add example
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:


How the snapper determines a point is as such:
How the snapper determines a point is as such:
2. the snapper component will reduce the distance from the provided point to the center of the snapper to a distance of 1.
# the snapper component will reduce the distance from the provided point to the center of the snapper to a distance of 1.
3. It then takes the number and aligns it to the closest point on the shape. since this is a sphere snapper, it doesn't need this step.
# It then takes the number and aligns it to the closest point on the shape. since this is a sphere snapper, it doesn't need this step.
4. the snapper will then multiply the normalized point by the snapper's size in all 3 axes, and then return the result.
# the snapper will then multiply the normalized point by the snapper's size in all 3 axes, and then return the result.


The functionality of this component is internal, and cannot be used by [[ProtoFlux]] to snap points using in game code.
The functionality of this component is internal, and cannot be used by [[ProtoFlux]] to snap points using in game code.
Line 25: Line 25:
<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
Used as an anchor point generator in the [[Component:MultiUserAvatarAnchor|Multi User Avatar Anchor Component]] and other components.
Used as an anchor point generator in the [[Component:MultiUserAvatarAnchor|Multi User Avatar Anchor Component]] and drawing tools.


<!--T:4-->
<!--T:4-->

Latest revision as of 19:05, 29 February 2024

Component image 
Snap Sphere component as seen in the Scene Inspector


A snap sphere is a component that is able to generate a point in a sphere shape along the outer shell when given a point by another component. Usually this is used in components like the Multi User Avatar Anchor Component to determine where to place the anchors upon clicking (click point is used in such case)

How the snapper determines a point is as such:

  1. the snapper component will reduce the distance from the provided point to the center of the snapper to a distance of 1.
  2. It then takes the number and aligns it to the closest point on the shape. since this is a sphere snapper, it doesn't need this step.
  3. the snapper will then multiply the normalized point by the snapper's size in all 3 axes, and then return the result.

The functionality of this component is internal, and cannot be used by ProtoFlux to snap points using in game code.

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
Radius Float the radius of the sphere
SnapParent Slot where the objects to be snapped should go, if they are slots.

Usage

Used as an anchor point generator in the Multi User Avatar Anchor Component and drawing tools.

Examples

Related Components