Isolating physics of item attached to a moving rigid body
Hi how are you all? I have a slight challenge to resolve for a key feature in my Vive game. Essentially I have some physics -based controls the user can interact with attached to my vehicle which is also a rigid body that gets moved by force. I am in a situation where the controls are being heavily affected by the force of the vehicle moving, which I suppose we can call G-Force. What I would ideally like to do is isolate the physics based controls from the force of the moving vehicle, does anyone have any idea how to achieve this?
Thank you
Answer by Beloudest · Jul 08, 2016 at 11:01 AM
I think I have found the only straightforward solution. Create a rigid body with Kinematic enabled and the connect the control to that rigid body with a joint and then use a transform and rotation follow script to move the kinematic rigid body with the vehicle and the controls will move along fine.
Thank you! this worked for me.
for anyone curious, a follow script is as simple as this
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Follow$$anonymous$$e : $$anonymous$$onoBehaviour {
public GameObject toFollow;
// Update is called once per frame
void FixedUpdate () {
transform.position = toFollow.transform.position;
transform.rotation = toFollow.transform.rotation;
}
}
Your answer
Follow this Question
Related Questions
Door hinge joints 0 Answers
How to make rigidbody not effect movement while still using it for collisions? 0 Answers
Backspin of Sphere with Rigidbody 0 Answers
Applied physics force from animations. 0 Answers