Skip to content

Instantly share code, notes, and snippets.

@Drumsmasher17
Drumsmasher17 / PhysicsFollow.cs
Last active March 10, 2026 11:24
A copy of Valve's physics following logic as seen in 'The Lab'
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PhysicsFollow : MonoBehaviour
{
public Transform follow;
public Rigidbody rb;
void FixedUpdate()
protected virtual void OnTransformUpdated(SteamVR_Behaviour_Pose updatedPose, SteamVR_Input_Sources updatedSource)
{
GameObject attachedObject = currentAttachedObject;
if (attachedObject != null)
{
if (currentAttachedObjectInfo.Value.interactable != null)
{
currentAttachedObjectInfo.Value.interactable.CustomMoveStuffFunc(); // not real function name
}
}
@Drumsmasher17
Drumsmasher17 / BuggyCamFollow.cs
Last active March 25, 2018 14:55
"Camera boom" positioning for a zero-G driving game.
using UnityEngine;
public class BuggyCamFollow : MonoBehaviour
{
public BuggyInfo buggyInfo;
[Header("ReferenceTransforms")]
public Transform buggyTransform;
public Transform cameraBoom;