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 par-002 · Apr 17, 2013 at 11:10 PM · 2drotationpivoty axis

Rotation of GameObject w/ no movement

2D top down game. All movement is in the X and Z axis and rotation is in Y axis only.

I am using a GameObject with a Sphere Collider and a RigidBody. The RigidBody is set to be Kinematic.

I am manually moving the GameObject around w/

 GameObject.tranform.Translate(horizontalSpeed, 0, verticalSpeed);

Positioning is extremely important in what I am doing so if I do not keep track of every single x and z movement, everything gets completely fouled up.

All I want to do is rotate (pivot) the GameObject w/out moving it in any direction. The anchor point of the object is dead center of the object.

Every example I have found uses either GameObject.transform.Rotate(), GameObject.transform.RotateAround() or GameObject.transform.rotation = Quaternion-something...

No matter what I do, the GameObject will always move a little in the X or Z direction. I cannot have this. All I want is the object itself to rotate around its center point at the angle I specify.

Thank you!

PAR

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Dracorat · Apr 17, 2013 at 11:11 PM

If its moving some with those functions, the pivot point is wrong.

Double check it in your modeling program, also check that when you created the prefab, that you zeroed out the coordinates for all the relevant parts.

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 ExpiredIndexCard · Apr 17, 2013 at 11:15 PM 0
Share

That could also be the most likely answer. Check the pivot point

avatar image
0

Answer by ExpiredIndexCard · Apr 17, 2013 at 11:12 PM

Use a rigidbody and restrict it from moving. Ps you can still move the object through script. Ie. if you press 'up' the object will still move

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 par-002 · Apr 18, 2013 at 12:10 AM

Thanks for the replies but it turns out I was doing things incorrectly.

I am porting a game I did on iOS. There, movement was done via the Accelerometer. When I rotated the object, I did it incrementally based on the acceleration and velocity of the object.

Here, I am doing key inputs WASD and arrows. I shouldn't be doing the rotation based on increments of the velocity because the keys are "pretty close" to all or nothing. With that in mind, I changed my algorithm to do the angle between the magnitude of the horizontal speed vs the magnitude of the vertical speed. Tweaking for deceleration, I got it to do exactly what I wanted.

While you guys didn't have the right answer, it's not your fault due to me asking the wrong question :)

Sorry about that and thanks!

PAR

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

12 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

Related Questions

Rotate plane on a pivot to the mouse position (in 2D) 1 Answer

Problem with rotation and forward motion 2D Z-axis up 1 Answer

2D head breaks when flipping character 0 Answers

What causes this object to re-rotate itself after it hits it's destination? 1 Answer

how to tell a game object to move between 2 points(A,B) along x axis , right to left, and then move left to right back to its first position ??? 3 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