Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by atwillc · Apr 28 at 09:32 AM · physicsvroculus

Tripod with realistic physics in VR

I am making a simulation for setting up a survey station and tripod. Ideally the simulation would have realistic physics, and a requirement of this would be the ability to move the legs of the tripod so that the top can be level.

Does anyone have any insight on how to do this? The user needs to be able to move 1 or 2 of the legs at a time in order to line the tripod up with a point on the ground, and I don't want the entire tripod to move when the user moves any of the legs. I am thinking about using centerOfMass to make the tips of the legs stay on the ground, and hoping to get Configurable Joints to work on each of the legs in relation to the top base of the tripod stand.

Here is what I have currently. The angle of the legs in relation to the top part should be able to increase/decrease without moving the entire tripod.


EDIT: I am using Unity 2020.3.30f1 with Unity XR rig

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by atwillc · May 10 at 04:25 PM

It's not a fully accurate solution, but I figured out how to get this done for my purposes. First I made a script that tracks the Transform position on the end of the legs (added child gameObjects to each of the legs because they are extendable/retractable) and calculates the CenterOfMass to make sure the tripod doesn't topple over, since the Rigidbody is on the parent gameObject. Here is the script for that:


CalculateCenterPoint script

 public List<Transform> legs = new List<Transform>();
     float totalX = 0f;
     float totalY = 0f;
     float totalZ = 0f;
     float centerX = 0f;
     float centerY = 0f;
     float centerZ = 0f;
     Vector3 center;
 
     // Update is called once per frame
     void Update()
     {
         CalculateCenter();
     }
 
     public void CalculateCenter()
     {
         foreach (Transform leg in legs)
         {
             totalX += leg.transform.position.x;
             totalY += leg.transform.position.y;
             totalZ += leg.transform.position.z;
         }
         centerX = totalX / legs.Count;
         centerY = totalY / legs.Count;
         centerZ = totalZ / legs.Count;
 
         center = new Vector3(centerX, centerY, centerZ);
     }

I assigned this script to an empty gameObject called CalculateCenterPoint and made sure it was in the correct position relative to the end of the legs.


For the rotation of the legs, I ended up using a LookAt Constraint on the top of the leg since this is where the point of rotation would be - I just made sure the pivot point was at the point of rotation and also in the center of this rotation (I had it on one side of the leg's rotation axis and it made the rotation funky). This took a lot of tweaking to get the rotation right. I had to make sure that the RotationAtRest was 0,0,0 and the object's rotation in the scene was correct before editing the rotation offsets. I used a WorldUpObject (the top base of the tripod) so the constraint knew where "up" was.


For the LookAt Constraint to work properly, I used a slider to control and limit the movement of the leg rotation. This made it easy because I was able to have the leg LookAt Constraint Source be the Slider's handle so, as you move the slider, the leg moves with it. You can see it in action here


I hope this helps anyone trying to solve a similar issue! It's not perfect or ideal but seems to work best for VR development and not having to deal with Grab components.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

260 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Disabling VR Camera rotation creates ''cinema'' effect in VR device 1 Answer

How to stop hands from going through walls VR? 0 Answers

VR interactable soft bodies?? 0 Answers

Object movement choppy when picked up in VR 1 Answer

Get New Character Controller Package 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges