Created
March 25, 2021 02:34
-
-
Save diglateam3/0edff0588eb074363e47af39aad36458 to your computer and use it in GitHub Desktop.
指定したObjectのColliderにAddForceするUdonSharpスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UdonSharp; | |
using UnityEngine; | |
using VRC.SDKBase; | |
using VRC.Udon; | |
public class ObjectAddForce : UdonSharpBehaviour | |
{ | |
[SerializeField] private Collider targetObject; | |
[SerializeField] private Vector3 forceRatio; | |
public override void Interact() | |
{ | |
var targetRigidBody = targetObject.GetComponent<Rigidbody> (); | |
if (targetObject == null) return; | |
targetRigidBody.AddForce(forceRatio, ForceMode.Impulse); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment