This entity defines a fidget spinner inside the game Garry's mod. It can use prop for a spinner by creating a bunch for circular forces to spin the physics model around.
Do you remember when the spinner was such modern thing?
I made this SENT by request of a friend Alex Chosen and it fixes the following problems:
- General motor tool persisting in Gmod has tendency to rotate in the opposite way when the car is faced south-north
- Wire motor tool has strange behavior when the motor is duped or the spinning part receives high angular velocities
- Wheels do not have round shape so they bounce on high torques
That's fairly easy. There is a dedicated spinner tool already in Construction/Spinner Tool
.
- Create a spinner IN_ATTACK ( Def: Left click )
When you trace a prop it will be automatically be constrained relative to the
mass-center to the trace when you use one option from the
Constraint type
combo box besides skipping the constraint all around viaSkip linking
When you trace the world, it will just spawn it on the map. - Update a spinner IN_ATTACK ( Def: Left click ) This is done for every parameter except the modified collision radius to avoid making Lua errors in the think hook. This option actually destroys the physics object and creates new again, so your contraption constraints will just fail if I am to update that parameter
- Select a prop to use as a spinner IN_ATTACK2 ( Def: Right click )
When tracing a valid
prop_physics
, the trace normal vector will become the spin axis the right player vector will become force lever and their cross product will result in the force direction. The model will also get selected - Copy spinner settings IN_ATTACK2 ( Def: Right click )
When tracing a spinner, you can copy all its internal setup values and
apply these to other entity of the same class
sent_spinner
- Spin axis is the local vector to use for an axis a.k.a the vector which the spinner revolves around.
- Lever is the local vector which is used as a force offset origin affecting the angle for starting the force lever creation.
- Force is the local vector that produce the
spinner rotational force. You can have from one single primary force to the maximum of
360
. This parameter is defined by the cross product between(1)
and(2)
. - Rotation center is the point that all elements revolve
around. It is origin for the axis
(1)
and levers(2)
.
If you do not want to define your own vectors, you can use the already default pre-defined values by selecting a direction with a sign attached:
+X --> Forward local vector
+Y --> Left local vector
+Z --> Up local vector
-X --> Back local vector
-Y --> Right local vector
-Z --> Down local vector
These colors are representing all axes default chosen ones.
If you want to use your custom lever or axis u can select the <Custom>
option. That way the vectors which you select via model select right click
will be applied on the new spinner.
You have basically two HUD modes:
- When you trace a spinner
- The center position will be displayed with a yellow circle.
- The lever arm(s), using green line(s) ( yes, you can have only
one arm to the max of
360
) with the exact length stored in theSENT
. - Lever forces are scaled to the max value 50k, as
there is red part, which shows the scale of the whole, maximum
force available and yellow part, which shows the amount of force
used relative to the maximum ( Half red and half yellow means
50%
of the maximum power input a.k.a25k gfu
)
- When you trace a ordinary prop of class
prop_physics
- It will show the force , axis , lever and center vectors that will be used for the user customization setup option
Keep in mind that if you apply negative power, the torque will be reversed when using the numpad. The wire input is independent. It does not take the numpad direction into consideration as the value includes sign and magnitude.
Well yeah, you can play around with these using the console
sbox_maxspinner_drofs --> The offset unit direction vector magnitude to prevent displacement
sbox_maxspinner_scale --> Maximum scale for power and lever
sbox_maxspinner_mass --> The maximum mass the entity can have
sbox_maxspinner_radius --> Maximum radius when rebuilding the collision model as sphere
sbox_maxspinner_line --> Maximum linear offset for panel and clamping on the tool script
sbox_maxspinner_broad --> Maximum time [ms] when reached the think method sends client stuff
sbox_maxspinner_tick --> Maximum sampling time [ms] when the spinner is activated. Be careful!
sbox_enspinner_remerr --> When enabled removes the spinner when an error is present
sbox_enspinner_wdterr --> When enabled turns on the watchdog timer error
sbox_enspinner_timdbg --> When enabled outputs the rate status on the wire output
- The watchdog timer will be activated when the program in the think hook takes more time to execute than the actual entity tick interval chosen
- For using the timer debug array as a wire output, the user must set the convar to enabled, then create a spinner to invoke the initializing method
- The maximum spinner tick is the time between two think hook calls and it is used on spinner initialization. Be careful, do not set this too low !
Ahh, this again. Emm, NO. I will never give you my permission to do that. By doing this, you are forcing people to use an older copy of this script !