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 uberwiggett · Sep 23, 2020 at 02:53 AM · transform.positiontransform.rotationik

mimicking movement of one object to another with different scale/location.

G'day all,

I'm trying to 'mimick' or 'replicate' the movement of a gameobject controlled by mouse input, to a gameobject in the worldspace that is attached to the player.


I'm currently using a raycast to a sphere mesh to position a gameobject (cursorObjA) at a point on the sphere, as part of the user interface for my player control. This setup exists in the scene in a random spot, with a camera aimed at it so I can use it as an interface without it affecting the game world (and running into mesh collision errors).


What I want to do is get that position of the object, and use it to guide an IK point(cursorObjB) for the player's model, to guide the positioning of the hand/arm/body. When cursorObjA moves around the sphere, I want that same movement for ObjB, but upscaled to match the player mesh space.


concept


image above for reference of what's going on. I currently have the cursor system working but I am stuck trying to figure out how to pass the information through to object b, and constrain it so it mimicks the player's input. I've tried a few times using local rotation, with and without multipliers, and even tried to physically position the objects at the same point but couldn't get it to work properly.

The prime values I need to pass is the position, and the rotation on the z axis.


Does anyone know what methods or api functions I should be looking at to do this properly?

demonstrationofconcept.png (112.7 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
Best Answer

Answer by streeetwalker · Sep 23, 2020 at 04:26 AM

KInd of like Telepresence - cool idea!

If you convert your mouse position on the spherical section to spherical coordinates, you could then apply those to another sphere of any size any location you want. Once you pick the target sphere radius and location, you can convert them back to Cartesian coordinates to apply to your hand. If you need to rotate the target sphere to match the local orientation of the target, I guess you'd to that before you convert back. The equations to do all this are out there on the web.

If it is more convenient to use the rotation with respect to z, that is already a form of spherical coordinate. You just need to rotate that with respect to the local orientation of the target. I believe to do that, you can to get the rotation with respect to Z as a quaternion, and then multiply that by the local rotation of the target - something like that!

Comment
Add comment · Show 2 · 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
avatar image uberwiggett · Sep 23, 2020 at 05:19 AM 0
Share

Hi thanks for the response, have to wrap my head around it as the calculations behind it aren't my strong suit. I currently have the z rotate to what appears to be working, which is neat, just struggling to get the positioning correct. I was hoping to do away with a second sphere but it might actually be the way to go, simply match a co-ordinate position rather than a position in 3d space. Do you think that would be more or less resource intensive?

avatar image streeetwalker uberwiggett · Sep 23, 2020 at 08:00 AM 0
Share

sorry, i had to refresh my memory: It seems you already have half a spherical coordinate in th representation of your mouse position as a rotation with respect to z. If you can also describe the point as a rotation from a 2nd axis, then you I think you have everything you need to transform it to your hand/arm position.

I've done something like what you are doing in a similar context, but it has been a while. The math isn't that difficult: https://mathinsight.org/spherical_coordinates

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

210 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

Related Questions

Moving and rotating object to specific point (3D) 1 Answer

object referance not set to instance of an object when accessing transform.position 0 Answers

Velocity of parent local to child 1 Answer

how do i make an enemy look at the player only on the x axis and not on the y one,how do i make an enemy look at a player only on the x axis 0 Answers

Camerashake doesn´t work expected in Build c# 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