Holo Circle

From GMod Wiki

Revision as of 12:59, 16 November 2011 by [RV] TJjokerR (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Deletion.pngThis page has been nominated for deletion. Deletion is due within approximately 30 days from nomination, unless the deletion has been disputed on the talk page. See more pages nominated for deletion here.
Reason for deletion: Not what Garry wants the wiki to be used for
Last Edit was made on 11/16/2011



Contents

Holo Circle

Holo Circle: Holo Circle
Page white text.png Description:Creates a continuous circle with a HoloEmitter.
link=User:Entoros Original Author:Entoros
Calendar.png Created:December 22, 2008
Page white text.png Notes:Refer to my Double Holo Helix tutorial for a more advanced Holo technique.


Getting the Parts

To start out, we need to spawn all of the components necessary to make the holo circle happen. Bear in mind there may be quite a few gates; if you're experienced in expression, I'll copy the code if you'd like. If you're not sure where to place things, look at the image. So, to start out, follow these steps:

  1. Spawn something to put it all on. A PHX 1x1 or 2x2 plate is a good prop.
  2. Go to your Wire tab, scroll down until you find the HoloEmitter tool. The CLIENT: Max fade time slider defines the maximum time (in seconds) it can take for a holo to fade for your client (not the spawned emitter). Set it to something like 5 or something. Spawn the HoloEmitter at the top of your plate.
  3. Next, spawn a "timer" gate (under the "Gate - Time" menu) at the bottom of the plate.
  4. Above the timer gate, spawn two "multiply" gates ("Gate - Arithmetic").
  5. Then, under the "Gate - Trig" menu, spawn one of the "sin(rad)" and "cos(rad)" gates above the multipliers.
  6. Above those trig gates, spawn two more multiply gates.
  7. In the middle of all of these gates, spawn a "Constant Value" ("Wire - I/O") with number values of 1, 2, 3.14 (pi) and 50.
  8. In the middle of the plate, spawn a wire Button, "Toggle" checked, with a Value On of 1 and a Value Off of 0.
Legend: X = multiply, S = sin, C = cos, T = timer, V = constant value, H = holoemitter (sorry, I only have Paint)

Wiring the Components

Now that everything's spawned and ready, let's start wiring things up. If you get confused, refer back to the image of the finished product.

  1. Wire the "Run" of the timer to the constant value of 1.
  2. Wire the "A" of the first and the second multiplier to the timer and the "B" to the value of 2.
  3. Wire the "A" of the sin(rad) to the first multiplier and the "A" of the cos(rad) to the second multiplier.
  4. Wire the "A" of the third multiplier to the sin(rad) and the "B" to the value of 50.
  5. Wire the "A" of the fourth multiplier to the cos(rad) and the "B" to the value of 50.
  6. Wire the "X" of the HoloEmitter to the third multiplier.
  7. Wire the "Y" of the HoloEmitter to the fourth multiplier.
  8. This wont currently work, as the holoemitter only has a vector input (will be changed soon). For now, go to Gate - Vector and create a compose gate, then wire the emitters vector input to the gates vector output and treat the gate as the emitters x,y,z inputs.
  9. Wire the "Local" of the HoloEmitter to the value of 1.
  10. Wire the "FadeTime" of the HoloEmitter to the value of 3.14 (pi).
  11. Wire the "LineBeam" of the HoloEmitter to the value of 1 if you want a line between each holo
  12. Wire the "Active" of the HoloEmitter to the button.

It is done, now press the button and the HoloEmitter should start to make a circle. The only thing left to do is the most important thing, have fun and play around with what you wire and where you wire it!

The Finished Product

Now there's a couple different ways you can edit the circle. Here is a few of them, and some information about how stuff work, to help you understand everything.

The circle in action.

Expression Codes

Expression 1:

[label] Holo Circle
[inputs] 
[outputs] X Y
X = (sinr(Timer*2)*50
Y = (cosr(Timer*2)*50
interval(20)
Timer += 0.02

Expression 2:

@name Holo Circle
@inputs
@outputs X Y
@persist Timer
X = (sinr(Timer*2)*50
Y = (cosr(Timer*2)*50
interval(20)
    Timer += 0.02

This is just the basic expression for the holocircle. You can add stuff for FadeRate or Z or whatever. Also, I'm pretty sucky in both Expression 1 and 2. If you see any errors in this, please tell.

Explanation

I'm not the greatest at trig or anything, but the math involved is actually pretty simple. When you take the sine or cosine of a constantly changing number, the sine/cosine goes steadily from -1 to 1. So when you set your X as the sine and your Y as the cosine, for whatever reason it goes around in a circle (hey, I'm still in geometry, OK?).

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox