sensors.ForceSensor
- class sensors.ForceSensor(port: Optional[int])
Sensor for measuring linear forces and rotational torques.
- force() vector.Vector3
The force in newtons that the right (further x) surface is applying to the left surface from the left surfaces perspective. As a result of this, negative forces indicate compressive forces whereas positive forces indicate stretching forces.
The force is in the left (negative in the x axis) surface’s space meaning a value in the x axis is a force directly in the left surface’s x axis regardless of where the right surface’s x axis is pointed.
A slight filter is applied to smooth out values. For an unfiltered version see
force_stream()
For best results, avoid “chaining” joints together. The sensor will give more accurate results measuring collisions with objects that it is not connected to with a joint.
- force_x() float
Force in newtons that the right surface is applying to the left surface in the left surface’s x axis.
- force_y() float
Force in newtons that the right surface is applying to the left surface in the left surface’s y axis.
- force_z() float
Force in newtons that the right surface is applying to the left surface in the left surface’s z axis.
- force_stream() streams.Stream[vector.Vector3]
Creates a stream of unfiltered
force()
values in newtons.
- torque() vector.Vector3
The torque in newton meters that the right (further x) surface is applying to the left surface from the left surface’s perspective. As a result of this, negative values indicate the right surface rotating counter clockwise from the left surface’s perspective whereas positive values indicate a clockwise force.
The torque is in the left surface’s space meaning a value in the x axis is a torque directly around the left surface’s x axis regardless of where the right surface’s x axis is pointed.
A slight filter is applied to smooth out values. For an unfiltered version see
torque_stream()
If you are getting inconsistent results avoid “chaining” joints together with this part. The sensor will give more accurate results measuring collisions with objects that it is not connected to with a mechanical or rotatary joint.
- torque_x() float
Torque in newton meters that the right surface is applying to the left surface around the left surface’s x axis.
- torque_y() float
Torque in newton meters that the right surface is applying to the left surface around the left surface’s y axis.
- torque_z() float
Torque in newton meters that the right surface is applying to the left surface around the left surface’s z axis.
- torque_stream() streams.Stream[vector.Vector3]
Creates a stream of unfiltered
torque()
values in newton meters.
- name() str
Returns the user editable name of the controllable as found in the properties tab of the game.
from ports import PortReference print(PortReference(0).name())