#✅ | could you write a code for crosshair bobbing for spiffyhud?

1 messages · Page 1 of 1 (latest)

umbral prairie
#

i wanna make my crosshair shake in a random direction or in infinity (♾️) pattern that would get more intense as faster player runs

finite hemlockBOT
#

Hi! Please first select which type of question you want to ask:

  • "Normal Question" is enough for most questions. If you are unsure, you should choose this mode. It provides quick and accurate answers to your questions and problems.
  • "Complex Task" is for very complex questions and multi-step tasks. For example, questions involving complex action script, requirement, or placeholder logic. Normal users will almost never need this. Getting answers takes much longer here.

It is not possible for anybody to send messages in this thread before selecting a mode.

Selected mode: 💬 Normal Question

finite hemlockBOT
# umbral prairie i wanna make my crosshair shake in a random direction or in infinity (♾️) patter...

Yep, the easiest docs-based way is to make a small custom crosshair element and move it with Advanced Positioning 🎯

I don’t see a dedicated “crosshair bob” element in the docs, so this is the safest setup:

  1. Add a tiny Image/Shape element for your crosshair
  2. Anchor it to the Center of Screen
  3. If you want to hide the vanilla crosshair, use an Eraser over the center
  4. Put the following into the element’s X/Y advanced position fields

For the bobbing strength, I’m using your movement speed from:
player_position_delta_x and player_position_delta_z

That way it gets stronger the faster you move/run 🏃

∞ pattern version
Use this for a smooth infinity-style motion:

X:

{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * (2.0 + sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 20.0)"}}

Y:

{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * cos({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * (2.0 + sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 20.0)"}}

Random-ish shake version
This one feels more chaotic, without needing a Ticker:

X:

{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 47.0) * (2.0 + sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 20.0)"}}
#

Y:

{"placeholder":"calc","values":{"decimal":"false","expression":"cos({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 61.0) * (2.0 + sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 20.0)"}}

A couple quick tuning notes:

  • 2.0 = base shake even when standing still
  • 20.0 = how much sprint speed boosts the shake
  • 150.0, 47.0, 61.0 = animation speed

If you want it stronger, raise the 20.0.
If you want it faster, lower the 150.0 / 47.0 / 61.0.

If you want, I can also turn this into:

  • a tiny dot crosshair
  • a 4-line crosshair
  • or a true random-jitter version using a Ticker + variables 🙂
umbral prairie
#

btw, is it okay that "delay" block only works once?

finite hemlockBOT
# umbral prairie btw, is it okay that "delay" block only works once?

Yep, that’s normal 🙂 The Delay block is meant to wait once and then run the actions inside it. It’s not a repeating timer.

So:

  • Delay = one-time wait ⏳
  • While = repeat while a condition stays true 🔁
  • Scheduler = best option for repeating background logic over time 🧠

If you want something to happen again and again, don’t rely on Delay alone, use a While loop or a Scheduler instead.

If you want, I can show you the right setup for what you’re trying to do 👀

umbral prairie
#

alright, another question is: what is the difference between "if" and "while"?

finite hemlockBOT
# umbral prairie alright, another question is: what is the difference between "if" and "while"?

Yep 🙂

The difference is basically:

  • If = checks a condition once, and runs its block only if the condition is true.
  • While = keeps repeating its block continuously as long as the condition stays true 🔁

So in practice:

  • Use If when you want a one-time decision, like:

    • “If player is sprinting, do X”
    • “If variable equals true, show message”
  • Use While when you want a loop, like:

    • “While player is using an item, keep updating a bar”
    • “While condition stays true, keep running actions”

Small warning: While has a built-in timeout to help prevent infinite loops, so it’s for repeated logic, not super heavy nonstop stuff.

If you want, I can also show you a super simple example of each one in FancyMenu action script form 👌

umbral prairie
#

i tried ur code it's not working
crosshair image gets aligned to left upper corner instead of being at the center

finite hemlockBOT
# umbral prairie i tried ur code it's not working crosshair image gets aligned to left upper corn...

Ahh yep, that means the element is being positioned from the wrong origin point 😅

My previous snippet was only the bobbing offset, not the actual centering setup.

Try this:

  1. Right-click your crosshair Image element
  2. Set its Anchor Point to Center of Screen
  3. Then use only the bobbing offset in X/Y

If you want the crosshair to sit in the center even without relying on the anchor, use this centered version instead 👇
Replace crosshair_id with your element’s identifier.

X:

{"placeholder":"calc","values":{"decimal":"false","expression":"({"placeholder":"guiwidth"} - {"placeholder":"elementwidth","values":{"id":"crosshair_id"}}) / 2 + (sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * (2.0 + sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 20.0))"}}

Y:

{"placeholder":"calc","values":{"decimal":"false","expression":"({"placeholder":"guiheight"} - {"placeholder":"elementheight","values":{"id":"crosshair_id"}}) / 2 + (cos({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * (2.0 + sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 20.0))"}}

If you already set the anchor to center, then you don’t need the guiwidth/guiheight part, just the offset alone is enough.

So the short version is:

  • Anchor not centered → it ends up in the top-left
  • Anchor centered → bobbing works around the middle 🎯

If you want, I can give you a super simple “drop-in” version for:

  • a dot crosshair
  • a plus crosshair
  • or a more chaotic shake version 😄
umbral prairie
#

alright, now it works but i want crosshair to be static when player don't move
p.s. crosshair id is 1aa838e6-cf73-44c6-bdaa-f479bdb5d1be-1765131989558

finite hemlockBOT
# umbral prairie alright, now it works but i want crosshair to be static when player don't move p...

Yep, the reason it was still moving is that the old formula had a constant base shake in it (2.0 + ...), so it never fully settled 😅

If you want it to be totally static while standing still, remove that base part and make the shake depend only on movement speed.

Use this instead, with the crosshair anchored to the center of the screen 🎯

X:

{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 200.0"}}

Y:

{"placeholder":"calc","values":{"decimal":"false","expression":"cos({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 200.0"}}

What this does:

  • standing still → dx = 0 and dz = 0 → offset becomes 0
  • moving faster → larger deltas → stronger shake
  • the sine/cosine part still gives that nice circular / infinity-ish motion ♾️

If you want it a bit more visible, change 200.0 to something like 300.0 or 400.0.

And yeah, your element id:
1aa838e6-cf73-44c6-bdaa-f479bdb5d1be-1765131989558

You don’t need that ID for these two fields if the element is already anchored to center, but if you want I can also give you a version that uses the ID and centers it automatically 👀

umbral prairie
#

let's make it bobbing with ticker's help?

finite hemlockBOT
# umbral prairie let's make it bobbing with ticker's help?

Yep, that’s actually a nicer setup 😄

Since Ticker can run an action script repeatedly, it’s perfect for updating a bobbing offset over time.

Here’s a clean way to do it:

  1. Add a Ticker element to the same HUD layout
  2. Set its tick delay to something like 2050 ms
  3. Use the ticker to update 2 variables:
    • crosshair_bob_x
    • crosshair_bob_y
  4. Make your crosshair element read those variables for its X/Y offset
  5. Keep the crosshair anchored to the Center of Screen 🎯

Ticker actions
Use these as the ticker’s action script:

Set Variable Value:

crosshair_bob_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({\"placeholder\":\"uptime_duration\",\"values\":{\"output_as_millis\":\"true\"}} / 150.0) * sqrt(({\"placeholder\":\"player_position_delta_x\"} * {\"placeholder\":\"player_position_delta_x\"}) + ({\"placeholder\":\"player_position_delta_z\"} * {\"placeholder\":\"player_position_delta_z\"})) * 200.0"}}

Set Variable Value:

crosshair_bob_y:{"placeholder":"calc","values":{"decimal":"false","expression":"cos({\"placeholder\":\"uptime_duration\",\"values\":{\"output_as_millis\":\"true\"}} / 150.0) * sqrt(({\"placeholder\":\"player_position_delta_x\"} * {\"placeholder\":\"player_position_delta_x\"}) + ({\"placeholder\":\"player_position_delta_z\"} * {\"placeholder\":\"player_position_delta_z\"})) * 200.0"}}

Then on the crosshair element:

  • X = {"placeholder":"getvariable","values":{"name":"crosshair_bob_x"}}
  • Y = {"placeholder":"getvariable","values":{"name":"crosshair_bob_y"}}

Why this works:

  • standing still → movement deltas are 0 → bobbing becomes 0
  • moving faster → bigger deltas → stronger bobbing
  • sin / cos give it that smooth circular / infinity-ish motion ♾️

A couple tuning tips:

  • 150.0 = motion speed
  • 200.0 = bob strength
  • If you want it more intense, raise 200.0
  • If you want it smoother, increase the ticker delay a bit
#

If you want, I can also make you:

  • a pure random-jitter version
  • a softer “breathing” crosshair
  • or a version that only shakes while sprinting 🏃‍♂️
umbral prairie
#

what are these slashes in ur code text? could you remove em?

finite hemlockBOT
# umbral prairie what are these slashes in ur code text? could you remove em?

Yeah, those \ slashes were just escape characters from how I wrote the snippet here 😅

You generally do not need them in FancyMenu. You can paste the placeholder text without the backslashes.

Use these cleaner versions:

crosshair_bob_x

crosshair_bob_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({\"placeholder\":\"uptime_duration\",\"values\":{\"output_as_millis\":\"true\"}} / 150.0) * sqrt(({\"placeholder\":\"player_position_delta_x\"} * {\"placeholder\":\"player_position_delta_x\"}) + ({\"placeholder\":\"player_position_delta_z\"} * {\"placeholder\":\"player_position_delta_z\"})) * 200.0"}}

crosshair_bob_y

crosshair_bob_y:{"placeholder":"calc","values":{"decimal":"false","expression":"cos({\"placeholder\":\"uptime_duration\",\"values\":{\"output_as_millis\":\"true\"}} / 150.0) * sqrt(({\"placeholder\":\"player_position_delta_x\"} * {\"placeholder\":\"player_position_delta_x\"}) + ({\"placeholder\":\"player_position_delta_z\"} * {\"placeholder\":\"player_position_delta_z\"})) * 200.0"}}

And for the crosshair element itself:

X:

{"placeholder":"getvariable","values":{"name":"crosshair_bob_x"}}

Y:

{"placeholder":"getvariable","values":{"name":"crosshair_bob_y"}}

If you want, I can rewrite the whole ticker setup in a super clean copy-paste form with zero extra clutter 👍

umbral prairie
#

there are still backslashes, gal 💀

finite hemlockBOT
# umbral prairie there are still backslashes, gal 💀

Yep, my bad 😅 FancyMenu placeholders are not real JSON, so the nested placeholders should be written raw, no backslashes at all.

Use these exact ones:

crosshair_bob_x

crosshair_bob_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 200.0"}}

crosshair_bob_y

crosshair_bob_y:{"placeholder":"calc","values":{"decimal":"false","expression":"cos({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 200.0"}}

And for the crosshair element:

X:

{"placeholder":"getvariable","values":{"name":"crosshair_bob_x"}}

Y:

{"placeholder":"getvariable","values":{"name":"crosshair_bob_y"}}

Make sure the crosshair element is anchored to the center too 🎯

If you want, I can also make you a version that only bobs while sprinting, not while walking 👀

umbral prairie
#

why is there uptime duration placeholder?

finite hemlockBOT
# umbral prairie why is there uptime duration placeholder?

Because it’s basically the “clock” for the motion 😄

uptime_duration is just a placeholder that keeps increasing over time, so sin() / cos() have something to animate with.

In your bobbing setup:

  • player_position_delta_x / player_position_delta_z = how much you’re moving
  • uptime_duration = the time value that makes the crosshair move in a smooth wave

Without a time-based placeholder like that, the crosshair would just calculate one fixed offset and wouldn’t really “bob” properly.

Docs-wise, uptime_duration returns how long FancyMenu has been loaded, and you can use output_as_millis:true to get milliseconds instead of seconds.

So basically:

  • no uptime_duration = no animation wave
  • with uptime_duration = smooth moving bob 🌀

If you want, I can also rewrite the formula using game_time instead, but uptime_duration is usually the cleaner one for this kind of effect.

umbral prairie
#

okay, new problem: crosshair is aligned to the corner again

finite hemlockBOT
# umbral prairie okay, new problem: crosshair is aligned to the corner again

Ah yep, that’s usually the anchor point again 😅

FancyMenu positions elements from their anchor, and if it got reset to Original / top-left, the bobbing starts in the corner.

Do this first:

  • Right-click the crosshair element
  • Set Anchor Point to Center of Screen
  • If the size can change, turn on Sticky Anchors too

Then use the bob variables like this:

X:

{"placeholder":"getvariable","values":{"name":"crosshair_bob_x"}}

Y:

{"placeholder":"getvariable","values":{"name":"crosshair_bob_y"}}

If it still insists on using the corner, use this fully centered version instead for the element’s position fields:

X:

{"placeholder":"calc","values":{"decimal":"false","expression":"({"placeholder":"guiwidth"}-{"placeholder":"elementwidth","values":{"id":"1aa838e6-cf73-44c6-bdaa-f479bdb5d1be-1765131989558"}})/2+{"placeholder":"getvariable","values":{"name":"crosshair_bob_x"}}"}}

Y:

{"placeholder":"calc","values":{"decimal":"false","expression":"({"placeholder":"guiheight"}-{"placeholder":"elementheight","values":{"id":"1aa838e6-cf73-44c6-bdaa-f479bdb5d1be-1765131989558"}})/2+{"placeholder":"getvariable","values":{"name":"crosshair_bob_y"}}"}}

So:

  • ticker = writes the bob amount
  • crosshair element = reads the bob amount
  • anchor = keeps it in the middle 🎯

If you want, I can give you the whole setup again in one clean block: ticker + variables + element fields all together 🙂

umbral prairie
#

nice, it works, but how can i reduce the intensity?

finite hemlockBOT
# umbral prairie nice, it works, but how can i reduce the intensity?

Yep, just lower the final multiplier in the calc 🙂
That * 200.0 part is basically the shake strength.

Try something like:

  • * 100.0 = medium
  • * 50.0 = subtle
  • * 20.0 = very mild

So for example, change:

... * sqrt((...) + (...)) * 200.0

to:

... * sqrt((...) + (...)) * 50.0

If you want, here’s the idea for both variables:

crosshair_bob_x

crosshair_bob_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 50.0"}}

crosshair_bob_y

crosshair_bob_y:{"placeholder":"calc","values":{"decimal":"false","expression":"cos({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 50.0"}}

If you want, I can also make it:

  • tiny and subtle
  • normal vanilla-like bob
  • or a more “swingy” sprint bob 😄
umbral prairie
#

alright, everything works but i don't really like that pattern is a circle-like, maybe we could make it w-like or ♾️-like?

finite hemlockBOT
# umbral prairie alright, everything works but i don't really like that pattern is a circle-like,...

Yep, totally 🙂
The circle happens because sin() + cos() at the same speed makes a round path.

If you want a different vibe, swap the ticker formulas to one of these:

Option 1: ♾️ / figure-eight vibe

crosshair_bob_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 40.0"}}
crosshair_bob_y:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * cos({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 80.0"}}

Option 2: W-like bob

crosshair_bob_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 40.0"}}
crosshair_bob_y:{"placeholder":"calc","values":{"decimal":"false","expression":"(abs(sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 75.0)) - 0.5) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 80.0"}}

Quick tuning:

  • lower 40.0 / 80.0 = less movement
  • lower 150.0 / 75.0 = faster movement
#

If you want, I can also make it more:

  • shaky and chaotic 😵‍💫
  • smooth vanilla-like
  • or a tiny “breathing” crosshair 🫶
umbral prairie
#

just in case: i use vars "cross_x" and "cross_y", and in the end i multiply everything by 5 rather than 80/40/whatever (everything >5 is too shaky)

finite hemlockBOT
# umbral prairie just in case: i use vars "cross_x" and "cross_y", and in the end i multiply ever...

Gotcha, that makes sense 😄
If 5 already feels right, that’s totally fine, just use that as your final strength multiplier.

Using your variable names, you can do it like this:

Figure-eight / ♾️ vibe

cross_x

cross_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

cross_y

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * cos({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

W-like vibe

cross_x

cross_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

cross_y

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"(abs(sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 75.0)) - 0.5) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

And then your crosshair element just reads:

X:

{"placeholder":"getvariable","values":{"name":"cross_x"}}
#

Y:

{"placeholder":"getvariable","values":{"name":"cross_y"}}

So yeah, tiny multiplier like 5.0 is the move if you want it super subtle 🎯
If you want, I can also tune the speed part so the pattern is a bit slower and smoother without making it stronger.

umbral prairie
#

didn't you just messed up the cross_y code part?

finite hemlockBOT
# umbral prairie didn't you just messed up the cross_y code part?

Yeah, I did cut it off there 😅 sorry about that.

Here’s the full clean version again with your vars cross_x and cross_y, using 5.0 as the strength.

If you want the W-like version, use:

cross_x

cross_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

cross_y

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"(abs(sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 75.0)) - 0.5) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

If you want the ♾️ / figure-eight version instead, use:

cross_x

cross_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

cross_y

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * cos({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

And then your crosshair element should use:

X:

{"placeholder":"getvariable","values":{"name":"cross_x"}}
#

Y:

{"placeholder":"getvariable","values":{"name":"cross_y"}}

If you want, I can make it even cleaner and give you just one final exact setup with no alternative options at all 🙂

umbral prairie
#

what is "(abs("? i think it makes cross_y ticker part not working

finite hemlockBOT
# umbral prairie what is "(abs("? i think it makes cross_y ticker part not working

Yep, abs() just means "absolute value" 🙂

So:

  • abs(3) = 3
  • abs(-3) = 3

That (abs( part is just:

  • ( = normal parentheses
  • abs( = the calculator function

It should be supported by FancyMenu’s calc placeholder, but if that line is giving you trouble, we can skip it entirely. That’s probably the easiest fix 👍

Try this simpler cross_y instead for a smoother wave-ish motion:

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 75.0) * sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

And keep cross_x like this:

cross_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

If you want, I can give you:

  • a clean ♾️ version
  • a clean W version
  • or a version with zero abs() and zero chance of syntax weirdness 😄
umbral prairie
#

could you make it react to player falling/flying direction?

finite hemlockBOT
# umbral prairie could you make it react to player falling/flying direction?

Yep, for that, the best doc-supported thing to use is player_position_delta_y 🙂
That placeholder gives you the change in Y between ticks:

  • positive = moving up
  • negative = falling / moving down

So you can use it as the “direction” signal for the crosshair bob 🧭

If you want the bob to flip based on up vs down, the cleanest way is to use the sign of that value:

{"placeholder":"math_sign","values":{"num":"{"placeholder":"player_position_delta_y"}"}}

Then you can multiply your vertical offset by that.

So conceptually:

  • cross_x = your normal wave
  • cross_y = wave × direction from player_position_delta_y

That means the bob will react differently when you’re going up or down instead of always moving in the same pattern.

If you want, I can write the exact cross_x / cross_y ticker values for you using your current setup and keep the strength at 5.0 👍

umbral prairie
#

write it with cross_y

finite hemlockBOT
# umbral prairie write it with cross_y

Yep, here’s a clean cross_y that reacts to vertical movement direction using player_position_delta_y 🙂⬆️⬇️

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * {"placeholder":"player_position_delta_y"} * 5.0"}}

This way:

  • moving up = positive offset
  • falling/down = negative offset
  • the stronger the Y movement, the stronger the offset

If you want, I can also write a version that keeps a tiny idle wobble when you’re not moving vertically, so it doesn’t go fully flat on the Y axis 😄

umbral prairie
#

will it work with player movement part if i create 3rd "set var"?

finite hemlockBOT
# umbral prairie will it work with player movement part if i create 3rd "set var"?

Yep, that should work 🙂
You can absolutely use a 3rd Set Variable for the player movement part, as long as it gets set before the variable that uses it.

So the order should be like:

  1. set movement var, for example move_y
  2. set cross_x
  3. set cross_y using move_y

Example:

move_y:{"placeholder":"player_position_delta_y"}

Then:

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * {"placeholder":"getvariable","values":{"name":"move_y"}} * 5.0"}}

That way the movement value is stored first, and cross_y reads it after 👍

If you want, I can lay out the whole 3-variable ticker in the exact order you should paste it, so it’s copy-paste ready 😄

umbral prairie
#

uhh, ts looks suspicious, could you just implement player falling delta and player walking delta?

finite hemlockBOT
# umbral prairie uhh, ts looks suspicious, could you just implement player falling delta and play...

Yeah, and good call on keeping it simple 😄

FancyMenu doesn’t have a dedicated “walking delta” placeholder, so we build it from player_position_delta_x + player_position_delta_z like this:

cross_x = walking movement

cross_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}

cross_y = falling/jumping movement

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"{"placeholder":"player_position_delta_y"} * 5.0"}}

So:

  • walking sideways/forward/back = affects cross_x
  • moving up/down = affects cross_y
  • positive player_position_delta_y = going up
  • negative player_position_delta_y = falling

If you want, I can also give you a version where cross_y gets inverted while falling so it feels more like a sway instead of just raw vertical movement 🎯

umbral prairie
#

alright, let's make it also inverted while falling

finite hemlockBOT
# umbral prairie alright, let's make it also inverted while falling

Yep, use the sign of player_position_delta_y so the Y motion flips when you’re falling/downward 🙂⬇️

Try this for cross_y:

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * {"placeholder":"math_sign","values":{"num":"{"placeholder":"player_position_delta_y"}"}} * 5.0"}}

What it does:

  • moving up = one direction
  • falling/down = flipped direction
  • standing still on Y = 0

If you want, I can also make a version that still scales with fall speed instead of just using the direction 👍

umbral prairie
#

it's moving harsh now

finite hemlockBOT
# umbral prairie it's moving harsh now

Yep, that harshness is from math_sign. It jumps straight to -1 / 0 / 1, so the motion snaps instead of flowing 😅

Use the raw player_position_delta_y instead. It already has the direction built in, and it changes smoothly.

Try this:

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * {"placeholder":"player_position_delta_y"} * 5.0"}}

If that’s still a bit much, lower the 5.0 to 2.0 or 1.0 🙂

So the simple rule is:

  • math_sign = harsh / snapping
  • player_position_delta_y = smoother / more natural

If you want, I can also give you a smoother version that slightly exaggerates falling but still stays soft 🎯

umbral prairie
#

and now: how do i make it only shake when player is running? i know there is a requirement but when player is not running crosshair just freezes in the last position instead of going back to the center

finite hemlockBOT
# umbral prairie and now: how do i make it only shake when player is running? i know there is a r...

Yep, that happens because the shake values are probably only getting updated while the running requirement is true, so when you stop running the last value just stays there 😅

The fix is: don’t hide/stop the crosshair variables themselves. Instead, make the ticker reset them to 0 when the player is not running.

Use an IF / ELSE in the ticker’s action script:

IF (Is Player Running)
  cross_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sqrt(({"placeholder":"player_position_delta_x"} * {"placeholder":"player_position_delta_x"}) + ({"placeholder":"player_position_delta_z"} * {"placeholder":"player_position_delta_z"})) * 5.0"}}
  cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * {"placeholder":"player_position_delta_y"} * 5.0"}}
ELSE
  cross_x:0
  cross_y:0

So:

  • while running: shake values update
  • not running: both vars get reset to center

If you already put the Is Player Running requirement on the crosshair element itself, remove that and put the requirement logic on the ticker instead. That way the values can still be reset properly 👍

If you want, I can also write this as a FancyMenu-style action script block by block, with the exact IF, ELSE, and Set Variable Value actions 🙂

umbral prairie
#

maybe there's any other way to make crosshair bob without moving it harshly stud by stud?

finite hemlockBOT
# umbral prairie maybe there's any other way to make crosshair bob without moving it harshly stud...

Yep, if you want it to feel less “step by step,” the main thing to know is:

player_position_delta_x/y/z are tick-based, so they’ll always feel a bit stepped 🫠

The smoother doc-backed options are:

  1. Use an Element Animator
  • It animates position over time with keyframes, so it’s much smoother than tick-driven vars.
  • You could make a bobbing crosshair layout and only show that layout while Is Player Running is true.
  1. Stay with vars, but use a time-based sine wave
  • Drive the shake from uptime_duration instead of movement deltas.
  • Then reset the vars to 0 when the player is not running.

For the second option, the clean pattern is:

IF Is Player Running
  cross_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * 5.0"}}
  cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"cos({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * 5.0"}}
ELSE
  cross_x:0
  cross_y:0

That’ll look way smoother than movement deltas 🎯

If you want, I can do one of these next:

  • make the exact Element Animator setup
  • or make the ticker version feel more like a soft bob instead of a circle 🙂
umbral prairie
#

maybe there's possibility to make crosshair movement U-shaped?

finite hemlockBOT
# umbral prairie maybe there's possibility to make crosshair movement U-shaped?

Yep, absolutely 🙂
If you want a more obvious “U” shape, the easiest no-abs() way is to square the sine wave.

Try this for cross_y:

cross_y:{"placeholder":"calc","values":{"decimal":"false","expression":"(sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0)) * 5.0"}}

Why this works:

  • sin(...) goes up and down
  • sin(...) * sin(...) makes it always positive
  • that gives you a nice U-shaped curve instead of a full wave

If you want a matching cross_x, you can keep it simple like:

cross_x:{"placeholder":"calc","values":{"decimal":"false","expression":"sin({"placeholder":"uptime_duration","values":{"output_as_millis":"true"}} / 150.0) * 5.0"}}

And if you still want it only while running, keep your IF Is Player Running logic and set both vars to 0 in the ELSE part so it returns to center properly 🙂🎯

If you want, I can turn this into the exact full ticker block for you.

umbral prairie
#

hey, i have an idea
can you read a code of crosshair bobbing mod and re-create it for fancymenu?

finite hemlockBOT
# umbral prairie hey, i have an idea can you read a code of crosshair bobbing mod and re-create i...

Yeah, I can help with that 🙂
But I can’t open a repo link or inspect a code file directly here.

If you want me to recreate it in FancyMenu, please paste the relevant code snippet right into chat, or describe the bobbing behavior you want. Then I can translate the logic into FancyMenu placeholders / ticker / action script stuff for you 🎯

If the code is in a .java, .kt, or other plain text file attachment, I also can’t read that file type here, so pasting the code is the best way.

Send me:

  • the bobbing code
  • or the part that calculates the crosshair offset
  • and I’ll turn it into a FancyMenu version for you 😄
finite hemlockBOT
#
Thread Marked as Solved

This support thread has been marked as solved by @umbral prairie.

The AI helper is now disabled.