Skip to content

Instantly share code, notes, and snippets.

View hobione2k's full-sized avatar

hobione hobione2k

View GitHub Profile
@hobione2k
hobione2k / aliases\Logitech_G923_TRUEFORCE_Racing_Wheel_PS_USB.xml
Last active May 31, 2025 19:23 — forked from qcho/aliases\Logitech_G923_TRUEFORCE_Racing_Wheel_PS_USB.xml
日本のG923向けCity Car Driving 設定ファイル - Logicool G GUB G923 Racing Wheel for PlayStation 4 and PC (USB)
<?xml version="1.0"?>
<Alias targetDevice1="Logicool G GUB G923 Racing Wheel for PlayStation 4 and PC (USB)"
targetDevice2="Logitech G923 TRUEFORCE Racing Wheel PS"
targetProductGuid="{C266046D-0000-0000-0000-504944564944}">
<Axis axis="x" name="Steering" />
<Axis axis="y" name="Gas" />
<Axis axis="rz" name="Brake" />
<Axis axis="slider:0" name="Clutch" />
<Button number="1" name="X" />
<Button number="2" name="Square" />
@hobione2k
hobione2k / voiceArea.js
Last active April 14, 2025 17:12
ClusterScript ボイスエリア
// エリアに入ったプレイヤーにグループを設定するやつ //
// こちらの記事のサンプルのMixerプレハブが必須
// https://creator.cluster.mu/2025/04/14/voicevolumerateof-sample/
// OverlapDetectorShapeコンポーネントが必要
const DEFAULT_GROUP = 0; // デフォルトのグループ
// groupIDを取得
const getGroupId = () => $.getStateCompat("this", "group", "integer");
// getOverlaps()からPlayerHandleをまとめて取得
@hobione2k
hobione2k / ToggleAvatar.cs
Last active October 21, 2024 09:08
[VRC] シーン内のアバターをボタンで切り替えるUnityEditor拡張(ボタンを押したアバターだけを表示)
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
using VRC.SDKBase;
using UnityEngine.SceneManagement;
#if UNITY_EDITOR
public class ToggleAvatar : EditorWindow
@hobione2k
hobione2k / continued_fraction.py
Last active June 7, 2024 05:47
某ワールド用
from decimal import Decimal, getcontext
from fractions import Fraction
from typing import Iterable, List
getcontext().prec = 4 * 8
def continued_fraction(n) -> Fraction:
if len(n) == 1:
return Fraction(n[0])
else:
@hobione2k
hobione2k / Template.js
Last active April 29, 2024 19:44
ClusterScript Template
const logLvl = () => $.getStateCompat(Tg.this, "LOG_LEVEL", T.integer);
const pd = (n, l = 2) => {
return n.toString().padStart(l, "0");
};
const now = () => {
const d = new Date();
const time = `${pd(d.getHours())}:${pd(d.getMinutes())}:${pd(
d.getSeconds()
)}.${pd(d.getMilliseconds(), 3)}`;
return time;
@hobione2k
hobione2k / aim.js
Last active March 22, 2024 20:16
ClusterScript 特定方向に向ける (Z軸 +z方向を前とする)
const rad2Deg = (r) => (r * 180) / Math.PI;
const aimAt = (pos, target) => {
const dir = target.clone().sub(pos);
const angleY = rad2Deg(Math.atan2(dir.x, dir.z)); // Y軸回転
const d = new Vector2(dir.x, dir.z).length();
const angleX = -rad2Deg(Math.atan2(dir.y, d)); // X軸回転
return new Quaternion().setFromEulerAngles(new Vector3(angleX, angleY, 0));
};
@hobione2k
hobione2k / sendAll.js
Last active March 22, 2024 20:15
ClusterScript Itemにsendするやつ
const sendAll = (items, type, value) => {
if (items == null) return;
items = items.concat();
while (items.length > 0) { // 送信先があれば実行
const item = items.shift(); // 取り出す
try {
item.send(type, value);
} catch (e) {
items.unshift(item); // エラーになったら戻して次回に回す
return items;
@hobione2k
hobione2k / GetAllPlayer.js
Last active March 22, 2024 09:22
ClusterScript ワールドにいるユーザーを一括取得するやつ
const activePlayer = (players) =>
players.filter((p) => p != null && p.exists());
const getAllPlayer = () => {
const players = $.getPlayersNear($.getPosition(), Infinity);
return activePlayer(players);
}
@hobione2k
hobione2k / attachSubNodeToPlayer.js
Last active March 11, 2024 14:42
ClusterScript(Beta) SubNodeをプレイヤーにくっつけるサンプル
// インタラクトしたユーザーの頭にアイテムをくっつける
// ※アイテムスケールが1であること
$.onInteract((player) => {
$.state.targetPlayer = player;
});
const attachSubNodeToPlayer = (subNode, player, bone, offset) => {
const bonePos = player.getHumanoidBonePosition(bone);
const boneRot = player.getHumanoidBoneRotation(bone);
const globalPos = bonePos.add(offset.clone().applyQuaternion(boneRot));
@hobione2k
hobione2k / attachItemToPlayer.js
Last active October 15, 2023 13:50
ClusterScript Beta アイテムをプレイヤーにくっつける(Item直接)
// インタラクトしたユーザーの頭にアイテムをくっつける
$.onInteract((player) => {
$.state.targetPlayer = player;
});
const attachToPlayer = (player, bone, offset) => {
const bonePosition = player.getHumanoidBonePosition(bone);
const boneRotation = player.getHumanoidBoneRotation(bone);
const position = bonePosition.add(offset.clone().applyQuaternion(boneRotation));
$.setPosition(position);