Skip to content

Fidget spinner scripted entity, and creator/updater tool for managment

License

Notifications You must be signed in to change notification settings

dvdvideo1234/SpinnerTool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spinner tool entity ( Copyright 2016 ME )

SpinnerTool

What does this thing do ?

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.

Why did you make this ?

Do you remember when the spinner was such modern thing?

We already have motor and wheel tool, why did you this, seriously ?

I made this SENT by request of a friend Alex Chosen and it fixes the following problems:

  1. General motor tool persisting in Gmod has tendency to rotate in the opposite way when the car is faced south-north
  2. Wire motor tool has strange behavior when the motor is duped or the spinning part receives high angular velocities
  3. Wheels do not have round shape so they bounce on high torques

How can I control this scripted entity ?

That's fairly easy. There is a dedicated spinner tool already in Construction/Spinner Tool.

  1. 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 via Skip linking When you trace the world, it will just spawn it on the map.
  2. 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
  3. 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
  4. 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

Spinner elements legend

  1. #A Spin axis is the local vector to use for an axis a.k.a the vector which the spinner revolves around.
  2. #L Lever is the local vector which is used as a force offset origin affecting the angle for starting the force lever creation.
  3. #F 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).
  4. #C Rotation center is the point that all elements revolve around. It is origin for the axis (1) and levers (2).

Pre-defined lever and axis directions

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:

#R +X --> Forward local vector
#G +Y --> Left local vector
#B +Z --> Up local vector
#R -X --> Back local vector
#G -Y --> Right local vector
#B -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.

How can I read the tool HUD properly. It displays some lines and circles ?

You have basically two HUD modes:

  1. 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 the SENT.
  • 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.a 25k gfu)
  1. When you trace a ordinary prop of class prop_physics
  • It will show the force #F, axis #A, lever #L and center #C vectors that will be used for the user customization setup option

I just created a fidget spinner but when I hit the forward numpad key and it goes in reverse ?

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.

Does this thing have some kind of tweaks ?

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 !

May I put this in a third party website ?

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 !

Have a nice time spinning this up !

About

Fidget spinner scripted entity, and creator/updater tool for managment

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages