func_pendulum Last edited 5 years ago2019-05-13 07:43:38 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

This article was converted from a previous version of TWHL and may need to be reviewed

  1. The formatting may be incorrect due to differences in the WikiCode processing engine, it needs to be revised and reformatted
  2. Some information may be out of date
  3. After the article is re-formatted and updated, remove this notice and the Review Required category.
  4. Some older articles are no longer useful, or they duplicate information from other pages. In this case, delete the page after merging any relevant information into other pages. Contact an admin to delete a page.
Brush Entity

This entity allows you to create an object that moves like a pendulum.

Attributes

[list]
[li]0 = Normal [li]Render Mode (rendermode) - Controls the type of rendering that is used for an object. Options are: [li]Pitch Yaw Roll (angles) - Sets the pitch (up / down), yaw (left / right) and roll (bank) respectively. The compass in WorldCraft / Hammer corresponds to Yaw. The settings are not always (or not all) used.[/li]
[li]Global Entity Name (globalname)[/li]
[li]FX Amount (renderamt)[/li]
[li]FX Color (rendercolor)[/li]
[li]ZHLT Lightflags (zhlt_lightflags)[/li]
[li]Light Origin Target (light_origin)[/li]
[li]Speed (speed) - Speed of movement of the pendulum.[/li]
[li]Distance (distance) - Distance in degrees the pendulum will swing. Negative values reverse the direction.[/li]
[li]Damping (damp) - If you specify a value here the pendulum will slowly narrow its movement until it stops moving. It will end in the middle of it's swing, so if you specified 90 degrees as its distance, it will stop at the 45 degree position. Range: 0 - 1000.[/li]
[li]Damage inflicted when blocked (dmg) - When movement is blocked by the player, he will receive this amount of damage.[/li]
[li]Minimum light level (_minlight)[/li]
[/list]

Flags

Notes

1 Comment

Commented 8 months ago2024-03-11 14:22:23 UTC Comment #106061
Just posting it here as well for convenience:

Linear Pendulum trick

If you want to simulate a linear pendulum (e.g. a weight on a spring that bobs up-and-down or side-to-side) you can do so by placing the ORIGIN brush at a distance far away from the pendulum.
To find the values to be given to the func_pendulum for a given length of oscillation you can use the equation
A = 2 × sin⁻¹(h / d)
User posted image
where h is how far from the center the pendulum should oscillate (half the total distance),
d is how far the center of the ORIGIN is from the center of the pendulum,
and A is the resulting angle we will use for Distance (distance).

To make sure it oscillates properly we also need to set negative half A to Pitch Yaw Roll (angles) in the appropriate axis.
As for the Speed (speed) you'd want a value that's near A, otherwise it'll move too fast (as the origin is so far away, small changes in the angle results in great changes in position of the pendulum).

As an example, let's say we have a pendulum we want to move up-and-down by 32 units in the Y/Z plane. We create our pendulum and set the ORIGIN brush to be 7300 units away along the Y axis and we use the equation to find A = 2 × sin⁻¹(32 / 7300) ≈ 0.5°.
So for our func_pendulum we set Distance to 0.5, Pitch Yaw Roll to 0 0 -0.25, Speed to 0.2, and we set the Start on and X-axis flags.
Note:
Make sure to set your calculator to use degrees, not radians

You must log in to post a comment. You can login or register a new account.