• 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 tleylan · May 31 at 11:10 PM · transformgrab

Sphere with Attach Transform?

Using a basketball as an example, when I grab it my hand is inside of the ball. The ball in this case is so large that my head is inside as well. Is there a transform (or anything) that will make the attach point the outside surface of the ball? I tried an attach transform but so far no luck.

I'm using an XR Ray Interactor to grab it if that makes a difference.

Comment
Add comment · Show 1
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 tleylan · Jun 01 at 02:24 PM 0
Share

... I believe I will use a different approach. There is a lot to be said for maintaining the center point of the sphere when rotating the object.

Again it is an XR Ray Interactor so can I limit the "pull" distance? Not the distance the ray is cast but rather how close I can pull the object towards my hand. I will guess this needs to be coded so while I'm looking for it any hints as to which event I add this to?

Thanks again.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by MarekRimal · Jun 01 at 09:31 AM

I am not exactly sure what have you tried but I guess when you grab the ball the hand snaps to the attach transform. When the attach transform is in the middle of the ball, then the hand snaps into the middle of the ball. If you put the attach transform on the surface of the ball then it will snaps to the surface. It would would have strange snap effect though because the attach point is on specific position (lets say the balls north pole). If you would like to remove this snap and be able to grab the ball in the exact point where your hand is then you can simply move the attach point to the hand position when the hand starts colliding with the ball.

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
avatar image
0

Answer by tleylan · Jun 01 at 12:18 PM

I tried placing it on the surface but as you point out it creates an odd effect. Clearly games have people grabbing basketballs and such do you think they are moving the attach point?

I was wondering if there was a way to define something that didn't snap to the center of the ball that I was unaware of.

Comment
Add comment · Show 6 · 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 MarekRimal · Jun 01 at 01:00 PM 0
Share

The hand is snapping to the attach point. So when you are about to grab the sphere, move the attach point to the hand position => No snapping. Solved.

avatar image MarekRimal · Jun 01 at 01:01 PM 0
Share

I mean by a script. Probably use some OnGrabEnter and OnGrabExit or what is there. In enter set the attach to the hand position and on exit set it to the center of the ball for example.

avatar image tleylan MarekRimal · Jun 01 at 01:21 PM 0
Share

I'll look into it, thanks.

avatar image tleylan MarekRimal · Jun 01 at 05:09 PM 0
Share

As far as I can see if I move the origin of the sphere then it will never rotate "in place" around the center point but rather around the new center point which is outside the sphere.

I think there must be some standard solution I'm overlooking.

avatar image MarekRimal tleylan · Jun 03 at 08:42 AM 0
Share

I think I am not much sure what are you trying to achieve. You want to grab a ball the same way as you would grab a basketball ball? That means you want to position your hand on the surface of the ball? Are you grabbing the ball from distance using some ray or directly using a hand? I mean normally in reality when you are holding a ball with your hand and rotating your hand the ball does not rotate around its origin but around the wrist you are holding it with... Its all about where to put the attach point.


If I understand correctly you want to grab a ball from a distance using a ray and you want to place your hand on the surface of the ball. Then set the attach transform to this position: Get a Vector3 dirToPlayerHand = (playerHand.position - ball.position).normalized() and then set the attach point to ball.position + dirToPlayerHand * ballRadius

Show more comments
avatar image
0

Answer by hirenmakwana · Jun 01 at 12:25 PM

try changing collider size

Comment
Add comment · Show 1 · 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 tleylan · Jun 01 at 01:22 PM 0
Share

Um... because that will work or you are guessing? Isn't the center point of a larger collider still the center point of the sphere?

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

183 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

Related Questions

Cant get Attach Transform of interactorObject. 1 Answer

[Beginner question] How to grab/attach an object to the player and then throw it 0 Answers

Pick Up Object using Rigidbody FPS 0 Answers

Area Effect Damage 2 Answers

Connecting transform with Vector3 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