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 /
avatar image
0
Question by marco.vidaurre · Dec 28, 2012 at 06:38 AM · projectilejointconfigurablejoint

Spring Joint and Tethered Ball

Hello,

I am wondering what the best approach for handling a tethered ball on a moving player might be. This is for 2D endless runner game. I have a CharacterController that runs right and increases velocity constantly.

Underneath the player transform I have a rigidBody(set to kinematic). The player holds a ball sprite which also has a rigid body and a configurable joint that operates like a spring joint. Have tried with a spring as well. The rigidBody under the player is the connected body. I have all of my settings set so that when the User mouse clicks a point then I apply a force and the ball sprite / sphere collider / rigid body goes flying off in x and y and then springs back.

I run into problems when the velocity of the player increases. The ball motion and trail renderer attached to it begin to stutter . That makes sense though since the player is moving faster.

I'm just wondering if this is the cleanest approach to something like this. It works OK I guess but I feel like I could do it better. I could try using non physics but would have to handle the collisions and get into some Vector math which I could do but would mean a lot of re-writing.

Also wondering if this is not a bad way to go then how should I set up my joint. I've looked in a few places and its hard to get any good reference on Configurable joints. Spring joint works about the same.

Thanks

Comment
Add comment · Show 2
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 Fattie · Dec 28, 2012 at 06:43 AM 0
Share

to be clear, it is a CharacterController ?

could you post an image showing the general situation so it's clearer, the sizes involved etc.

One thing you may have to do: "mixed" rigs are tricky. You may have to do something like this: make an invisible new physical object we'll call "the blimp". Write some code for it, using "AddForce" etc, that keeps the blimp always following the Character as best as it can. (Not unlike say a "camera car".) So it's a totally independent object, there is no parent relationship.

then, connect a "chain" perhaps with a "ball" on the end, actually to the "virtual blimp". (I'm not clear if you mean the ball is "on a string" or it just sort of bounces along with the player)

some thoughts...

avatar image marco.vidaurre · Dec 28, 2012 at 08:53 AM 0
Share

Thank you for the reply. Yes it is a character controller. The camera is orthographic and the size is set to 10. I'm using Sprite$$anonymous$$anager2 with pixel perfect on so my player sprite is about 90pixels tall.

The controller is on that gameObject. The connected body / rigid body is parented under the player sprite. I totally understand what you are saying about the independent "virtual blimp" .. I will give that a try. Would you know where the best place to place my configurable joint anchor at?

I've attached an image so that you can see what is going on. The player is moving in positive x and the ball's transform is placed exactly where the connected body is (slightly offset in positive x from the controller so that when the user presses the mouse button and launches the ball it does not collide with the character controller)

The ball is set to the connected body's position in the Update function as kinematic until someone launches it.

everything seems to work but I know there has to be a cleaner way. Thanks again!

Again

Connected body which you cant see in the image is parented under the sprite/character controller. I switch kinematic off and on on the ball spite ( just a sphere collider and rigid body) when the user launches the ball.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by marco.vidaurre · Dec 28, 2012 at 09:03 AM

alt text


screen shot 2012-12-28 at 8.52.06 pm.png.jpg (91.4 kB)
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

9 People are following this question.

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

Related Questions

Two way joint? 1 Answer

Getting a configurable joint to point at another object 2 Answers

Joint: Swing & Twist? 1 Answer

Configurable joints rotating at a certain angle 2 Answers

Is there a way to rotate the anchor of configurable joint? 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