Skip to content

Instantly share code, notes, and snippets.

@takoyakiroom
Last active September 12, 2020 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takoyakiroom/7bfe381980227f51f9c1bee93992bb88 to your computer and use it in GitHub Desktop.
Save takoyakiroom/7bfe381980227f51f9c1bee93992bb88 to your computer and use it in GitHub Desktop.
BodyCollider
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Collider dangling from the player's head
//
//=============================================================================
using UnityEngine;
using System.Collections;
namespace Valve.VR.InteractionSystem
{
[RequireComponent( typeof( CapsuleCollider ) )]
public class BodyCollider : MonoBehaviour
{
public Transform head;
void Awake()
{
}
void FixedUpdate()
{
// headの位置に合わせる(高さは重力に任せるので合わせない)
Vector3 pos = transform.position;
pos.x = head.transform.position.x;
pos.z = head.transform.position.z;
transform.position = pos;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment