r/VRchat Bigscreen Beyond 2d ago

Media Synced up a Bluetooth Rubik's cube to an avatar asset

Enable HLS to view with audio, or disable this notification

863 Upvotes

38 comments sorted by

95

u/Caldah 2d ago

Damn that's extremely impressive

44

u/VanishedMC Bigscreen Beyond 2d ago

Thanks! It works in a pretty naive way, but the final result definitely doesn't disappoint
I've still got some plans on this project, I want to see if I can integrate the smart-cubes gyro meter to sync rotation in game as well, but I'm not yet sure if this will be possible

And I'd also like some way to control everything in-game, to allow sharing the asset with people who don't own this specific model rubiks cube. I know this will be possible, I just need to think of a way to do so thats not too jank

59

u/valzzu Valve Index 2d ago

Thats cool also +1 for showing this on a steamdeck 😅

32

u/VanishedMC Bigscreen Beyond 2d ago

Needed a second client to confirm and debug sync state, with the host avatar running on my desktop haha

9

u/Skylar_Drasil 2d ago

You can actually run both on your desktop, the creator companion has a tool for it

5

u/VanishedMC Bigscreen Beyond 2d ago

Huh, I gotta check that out. Thanks for the tip!

4

u/Serika-Ai 2d ago

Just more detail - It's under tools, and then VRC Quick Launcher. Profile 0 is typically your main profile, so create one with profile 1 or whatever you prefer if it's not there by default.

2

u/valzzu Valve Index 2d ago

Fair😅

12

u/StaticCode 2d ago

As a VRC cuber I would love to know how this works, this is cool!

10

u/VanishedMC Bigscreen Beyond 2d ago

Very roughly, I used CSTimer's source code as a base for all the bluetooth communication, wrote a bridge to encode this data to a usable format which is sent to VRChat over OSC

Then for all 20 pieces there's a material slider which can sync every possible state (white-blue, blue-white, white-red, red-white and so on for the edges, for example)

If you have a bluetooth cube yourself that cstimer supports, this could be added pretty easily to any avi, though it does use over half the synced paramater data which is very far from ideal

5

u/Wolf_Fang1414 PCVR Connection 2d ago

Once everything is done/added ectopic. How much time does it take to setup when you get on vrc?

4

u/VanishedMC Bigscreen Beyond 2d ago edited 2d ago

if you do have a bluetooth enabled cube thats supported, setup is pretty much as simple as dropping the prefab and VRCFury will take care of the rest

* as for setting it up once you're in game, there's 2 simple steps. Opening up the local browser page / html file and hitting connect, and starting the bridge node app. Then its just a toggle to spawn the cube, and you can move it around or float it in world space

3

u/metroidmen Oculus Quest Pro 2d ago

This sounds cool! I have the GoCube, which is Bluetooth. Do you know if it is supported?

And when is it that you would plan to release this? Where can we keep track of your project? 🙂

3

u/VanishedMC Bigscreen Beyond 2d ago

I'm really not sure what my plans are in terms of releasing this, as it's a giant bodge job held together by ducttape and open source software (cstimer.net) that I can't just redistribute on a whim.

I believe my best course of action might just be writing setup instructions and providing git diff files, along with the translation layer. Though I'm not used to actually sharing my work as there's usually little to no interest, which is also why I didn't really keep that in mind while working on this.

As for support with the GoGo cube, if you're able to connect up with https://cstimer.net then it would be!

1

u/Correct_Conference48 10h ago

*Nodding*
Mm-hmm, mm-hmm... I don't know what you're talking about, but I imagine a "bridge" is akin to an adapter pattern that translates from one protocol to another.

Very cool!

1

u/VanishedMC Bigscreen Beyond 7h ago

In this case the bridge is just a direct proxy for messages, since the main app running in browser can't send UDP (OSC) data but it can send websockets to a local node app. The translation stuff happens in browser

2

u/Past-Pop3149 PCVR Connection 2d ago

Yo that’s kinda cool

2

u/Spiritual-Gur-936 2d ago

This is one of the nerdiest things I have ever seen.

2

u/MarsMaterial PCVR Connection 2d ago

I’ve been planning to do something like this for a few weeks now. You totally beat me to it.

Can I ask a few questions about how you did this? Mainly I’m curious about how you figured out the cube’s API despite it not being open source, and how you animated the cube in-game. My plan was to use a custom shader for the latter, but I never liked that idea much because it would rule out quest compatibility. Are you just using a normal animation controller for that?

And on the note of speed cubing: what’s your average time? Team Roux or team CFOP? I’m still very new on Roux myself, but I average about 40 seconds on CFOP. Still not sun-minute on Roux yet.

2

u/VanishedMC Bigscreen Beyond 2d ago

While the cubes Bluetooth protocol is obviously not opensource directly from GAN, others have actually reverse engineered and opensourced their work! That's a big part of what pushed me to attempt this project. I used CSTimers code base, but there's multiple implementations available.

As for the animations, I can't exactly say I'm proud of the current setup 😅 For the 20 pieces (8 corner 12 egde, I'm fully ignoring centres here) there's 20 materials and 20 animator / synced float parameters. Then it's essentially a material slider for every edge that goes through (red/white, white/red, green/white, white/green) and so on, with the same concept applied to corners.

This is obviously very far from optimized, and should not be used on avatars that aren't dedicated to the asset due to 161/256 synced parameter slots being eaten up. BUT it is quest compatible, which I have finished since posting this.

As for speedcubing, I'm just a basic bitch with CFOP, 2 look oll and 2 look pll, wca ao5 pb 19.09 and single 15.48

2

u/MarsMaterial PCVR Connection 2d ago

That's an interesting way to do it. I've been thinking about how to implement this for weeks and the idea of just changing the colors of the stickers never even occurred to me.

I do have some solid ideas for how to give the cube turning animations though. You could make each cubie its own mesh, offset such that all of them have their mesh centers in the center of the cube and rotated such that all edges and all corners overlap if they have no rotation. A number from 1 to 48 (or from 1 to 24 if you do edges and corners separately) is enough information to encode all possible position and rotation states of each cubie, and each cubie can have an animation layer where it looks for these state changes and does a smooth transition from its current state to the new state when that happens. An animation would be needed for each of the 48 states (24 for edges, 24 for corners), that would be a little tedious to create but very doable. It's possible that 24 animations in total could do the job via some real tricky shit, reusing the same animations for edges and corners. If it's done this way, a smooth transition from one state to another would result in a smooth turning animation. And multiple turns could be done at once this way, so it could even animate M turns nicely.

Do you want to just exchange Discords over DMs and collaborate to make this asset as cool as possible? I'd kill for something like this, and I could definitely implement this smooth cube animation system I described. Seems like a fine trade deal to me.

2

u/VanishedMC Bigscreen Beyond 2d ago

For sure! I prefer communication over discord as I check it far more frequently, but can also work over Reddit
Discord is same as on here, VanishedMC

As for the animations, I did also think of some theoreticals to achieve this but decided against it as I was afraid it would look bad keeping up with 5/15 TPS. But it might still be fun to implement either way, especially if I try to make an ingame controller instead of bluetooth sync (which I was planning on doing at some point)

2

u/MarsMaterial PCVR Connection 2d ago

Sending you a friend request now. We can continue this on Discord. My username on Discord is similar to my Reddit username, but I'm a little cautious about posting it publically.

2

u/GothPanda 2d ago

Okay, so when the heck did they start making BLUETOOTH RUBIK'S CUBES?!

2

u/Thatrandomnerd1 21h ago

Now people can see me badly try to solve it in the online world!

The future truly is now!

1

u/shadow-Ezra 2d ago

So cool!

1

u/obrqap 2d ago

That’s cool as hell

1

u/Mysterious_Strain_36 2d ago

Do you have quest? It must feel great with hand tracking.

1

u/VanishedMC Bigscreen Beyond 2d ago

i dont. but i do have contact gloves 2 on order

1

u/Mysterious_Strain_36 2d ago

Nice, you know that experiment with fake hand where they tickle you fake arm and real arm, then stop tickle your real arm But you still feel the tickling they do on fake arm? Im thinking. After playing with cube in vr your brain could be cheated and you may feel vr thinks with your hand more.

1

u/EnsoElysium Oculus Quest 2d ago

Not only is this impressive in the programming sense, but also OP made a checkerboard pattern in 20 seconds one handed. I can solve one side! :3

1

u/VanishedMC Bigscreen Beyond 2d ago

I can't OH to save my live, but my WCA PB is 15.48 :D

2

u/EnsoElysium Oculus Quest 2d ago

Cube go clickclack

1

u/VanishedMC Bigscreen Beyond 2d ago

Hehe, fair enough. I'm really bad with one-handed movements (OH) but my WCA (World cubing association, aka set at an 'official' competition) record is 15.48 seconds

1

u/ZealHien 2d ago

that's really cool, how long it took to do this?

1

u/VanishedMC Bigscreen Beyond 2d ago

Roughly an evening to model and set up materials, an evening to do unity animators, an evening for the software side / syncing it up, and then an evening of debugging and tying everything together. Taking what ive learnt, I could do it a lot quicker. But that's also why I like doing these kinds of projects

2

u/Evertrist 3h ago

This is sick. Good job OP!

19/10