2023.1.116.1 Linear Encoder
Overview
The Linear Encoder is a component that simulates a physical encoder.
Where to find
The Linear Encoder can be found under Standard Components > Linear Encoder > Add Physical Component
It will automatically be attached to a selected GameObject. Otherwise it will create a new GameObject to attach to.
A Prismatic Joint will be created automatically as part of the component.
Feature overview - Physical Component
Live Data |
|
---|---|
Value | Current value of the Linear Encoder |
Properties |
|
Prismatic Joint | Assign the Prismatic Joint you wish to use for the Linear Encoder. |
Cycle Value | The value difference between its zero position and max position. |
Base Value | The minimum value at zero position. |
Enable Rounding | Enables rounding the output to certain intervals. |
Rounding Interval | The interval rounding will occur to. |
Cap Value | Enables the use of a minimum and maximum value. |
Minimum Value | The minimum value of the output value |
Maximum Value | The maximum value of the output value |
On Value Changed () | UnityEvent that is fired as soon as the output value changes. |
Control Panel |
|
Generate Control Panel | Create a Control Panel for this component. |
Feature overview - Control Panel
Title | The Title of the Control Panel. Click to ping the target component in the hierarchy. Double click to edit. |
Linear Encoder Properties |
|
Value | Current value of the Linear Encoder |
Target Component |
|
Target Gameobject | The gameobject which has a standardcomponent you want the Control Panel for. |
Target Component | The Component which for which a Control Panel is generated. |
How to use - Physical Component
Create a Linear Encoder and setup its Prismatic Joint.
Add a Kinematics Controller, this can be found under Mechanics > Kinematics > Add Kinematics Controller to a seperate GameObject. Make sure the Linear Encoder is parented under the Kinematic Controller in the Hierarchy.
Set the desired settings for the Linear Encoder.
Enter PlayMode and test whether the Linear Encoder works.
Prespective Documentation