f-log

just another web log

05 Apr 2026:
reusable button

Reusable button

The further I get with the Godot Minesweeper VR game the more I find I need to create proper solutions.

You can get surprisingly far with scrappy it works code, but at some point you realise that you don't just need clean reusable code you crave it.

This was a quick attempt at a VR Button helper class to manage the three states or, Hover , Un-Hover and Hit .

You pass it the Mesh and the three materials that correspond to the different states. Very easy and straightforward, but I needed to complicate it :D

I wanted the user to see the button have a cool down state after hitting it. This had to allow the user to re-interact with the button before the cool down ended.

copy_colour_from_material_override(mesh_target.material_override, mat_tweening)
mesh_target.material_override = mat_tweening

if _tween && _tween.is_running():
    _tween.kill()
var trans = Tween.TRANS_QUART
var easing = Tween.EASE_IN
_tween = mesh_target.create_tween()
_tween.set_trans(trans).set_ease(easing).tween_property(
    mat_tweening,
    "albedo_color",
    mat_selected.albedo_color,
    duration
)
_tween.finished.connect(func(): is_active = false)

Everything updates the material_override which was where I hit a number of problems. First was that the Tween has to be added to the scene tree. The fix was easy, run the create_tween() on the passed Mesh. Then I had multiple instances where the animation would play and update the colour but would never work again, or would affect all the instances where the material was used in the game world.

The result was creating a special mat_tweening material and copying the colour information. Then externalising the Tween instance so it could be killed and restarted.

So I have a nice VrButton and VrRaycast to handle the interactions and visual state of buttons. Not sure I am going to have any more, just need to set the difficulty.

05 Apr 2026:
a and e

A and E

There are not many personal entries in this Flog, but this felt log worthy.

For reasons I was getting my blood taken on 1st April. It did not go well and I ended up talking an ambulance to Accident and Emergency. Was there for four hours hooked up to a drip.

The reasons are surprisingly long and twisty and include failing to draw blood on my own and having to pay someone else to do it for me.

This is number three. 1st was getting my Tattoo redone last year, then there was the aforementioned blood drawing attempt and now there is loss of consciousness. All three relate to my right arm, but that might be coincidence.

loading results, please wait loading animateloading animateloading animate
[More tags]
rss feed

email

root

flog archives


Disclaimer: This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk In fact I'm not responsible for anything ever, so there!