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 shopguy · Apr 26, 2014 at 06:29 AM · 2d2d-physics

2D platform anchored in center, rotate only

Are there any joints or special physic objects I can use to create a platform that acts like it has a peg through the center, so it is only allowed to rotate on the Z axis, but cannot move (location)?

I tried just not allowing the position to change with this script:

Vector3 StartPos;

 void Start () {
 StartPos = transform.position;
 }
 
 void Update () {
 transform.position = StartPos;
 }

However, that throws off the physics -- the way it interacts with the rest of the world and other objects. For example, if another object lands in the center of this object, it will slowly "pass through" the object, which just looks wrong/impossible. I imagine it is because the physics engine is actually trying to move my "fixed" object down, due to the weight of the other object landing on it... but then I'm forcing it back up, but in a way the physics engine doesn't recalculate for.

Hopefully I'm just missing something simple.

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 robertbu · Apr 26, 2014 at 06:34 AM 1
Share

Go to the Constraints section of the Rigidbody and freeze the x, y, and z position and the x and z rotation. Does this do the job?

avatar image shopguy · Apr 26, 2014 at 05:03 PM 0
Share

That's what I thought also, but I think that is only for 3D, don't see those properties for Rigidbody2D.

1 Reply

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

Answer by Pyrian · Apr 26, 2014 at 04:38 PM

Sounds like a HingeJoint2D to me.

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 shopguy · Apr 26, 2014 at 05:05 PM 0
Share

Thanks, I guess I didn't even look at that because of the name. Teaches me to look beyond the name, as the docs clearly state: "The hinge joint's name implies something like a door hinge (and it can certainly be used to implement that) but it refers more generally to anything that rotates around a particular point."

avatar image Pyrian · Apr 26, 2014 at 07:22 PM 0
Share

I know, right? The only reason I know it works like that is because I wanted something anchored at one end. Glad I could help. :)

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

21 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

Related Questions

Unity 2D Bend Sprites between HingeJoint2D 1 Answer

HingeJoint2D.GetReactionForce not working 1 Answer

how to make a 2d character three-dimensional? 1 Answer

2D random shooting problem with velocity, 0 Answers

Dash towards cursor 1 Answer


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