Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
  • Help Room /
avatar image
0
Question by matomatrica · Dec 12, 2020 at 12:11 PM · vrprogrammingoculustrackinginverse kinematic

Does anyone know of any documentation about this effect?

alt text

Maybe someone know of any existing documentation on this effect of a character model following the players movements? Ive found i few videos of people exploring this mechanic, but it literally lik 2-3 videos that i was able to find. And non of the creators shared any documentation about, i really need to achieve this effect, but i am not even an amateur in programming, and with no documentation its hard to understand where to even begin. If anyone knows more about or has even tried to achieve something like this, maybe then they could share some documentation or some source code used for it? Any information is highly appreciated. <3

screen-recording-2020-11-30-at-130835-6.gif (253.2 kB)
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

Answer by streeetwalker · Dec 12, 2020 at 07:34 PM

It would not be too difficult to do something like that, but if you are not a programmer it will be because you have to understand how you are going to relate the motion of one object to another.


In the example you show it is complicated by the fact that the hands and arms are probably child objects of the figure, so you would need to convert their local motion to values you could use on objects that are not children.

The basic idea is just to move one object based on the motion of another

You can set up a simple example controlling one game object - put 2 cubes into a scene, name them cube1 and cube2, spread them apart, and add this script to cube1. Place cube1 at the world origin, and don't rotate the cubes for this example - we want them aligned to the world x, y, and z axes. Also don't resize them.

create a new script named MoveCube and place it on cube1 as a script component. Be sure to match the name exactly upper and lower case.

 public class MoveCube {
      // assumes you are working in 3D 
 
     // drag the cube2 to this field in the inspector of this script
     public Transform cube2;
     
     public speed = 10f;
     private Vector3 cube2Offset;
     
     void Start(){
          // save the relative difference in the cubes' positions for later
          cube2Offset = cube2.transform.position - transform.position;
     }
     
     void Update((){     
               //move cube1 using the mouse up and 
               //down or use arrow up and down keys
              float translateZ = Input.GetAxis("Vertical") * speed * Time.deltaTime;
                
               transform.Translate( 0, 0, translateZ );
               
               // here is where we control cube2
               // I've put this in its own function just so 
               //  we can keep update simple
               MoveCube2(transform.position.x, transform.position.z);
     }
     
     private void MoveCube2( float x, float z ){
           // here we can manipulate x and z how ever we want
           // in this example, the farther away cube1 moves from world center
           // along the z axis, the closer cube2 will move to cube1
           // while paralleling cube1's motion on z
     
           //move closer to cube1 on the x axis the farther 
           // cube1 moves on z until they touch
           // what we do to x and z here we can call "transform functions"
           x += cube2Offset.x -  (cube2Offset.x * Mathf.Abs(z)/cube2Offset.x);
           float signX = Mathf.Sign( x );
           if( Mathf.Abs(x ) < 1 ){ // keep them at least 1 meter apart
                   x = 1 * signX;
            }
           // parallel cube 1 on the z axis
           z += cubeOffset.z;
           cube2.transform.position = new Vector3(x, 0, z) ;
     
     }
 }



That's it. You can play around with different starting positions for the cubes, and different statements to change the values of x and z in the MoveCube2 function.

Note that I called the changes we make to x an z "transform functions" if we just leave those to be:

 x += cubeOffset.x;
 z += cubeOffset.z;



Then cube2 will just move parallel with cube1 and maintain the same relative distance it had from the start. By altering the x and z transform functions, we can get cube2 to move in different ways as cube 1 moves.

I haven't tested this, but I don't think there are any errors in the code and I believe the math is solid for the described behavior.

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

274 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 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

VR body IK mimicking problem (searching for help). 0 Answers

Oculus Go & Unity: Microphone Real-time Playback 1 Answer

Tracking not working for both controllers at the same time on Oculus Quest build 7.0 6 Answers

Dots VR project.,need help in Dots VR project 1 Answer

[VR][VIVE] allow rotation only ? 4 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