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 Blackjackjulian · Apr 22, 2012 at 02:50 AM · camerarotationtransformlookatrotatearound

An alternative to RotateAround for collisions

I've got two player controlled objects that face each other at all times (named Red and Blue). Both one has a child chase camera. I want them to move towards and away the enemy, and rotate around it smoothly, when the standard 4 directions are pressed.

To move towards and away from each other, I use

 rigidbody.velocity = transform.forward * Movespeed
 

This works fine, for both the player and the child cameras. Smooth as butter.

To rotate, I tried to use RotateAround. It utterly broke the collisions, and the thing could just jump through objects because I wasn't affecting Velocity or Force, I was just translating it. So now I'm using:

 rigidbody.velocity = transform.right * Movespeed

This kind of works, since the LookAt updates every frame. But the fact that transform.right isn't the same as RotateAround means that the camera jumps and shakes every frame of movement because it has to adjust, and the player slowly moves away from the opponent when moving.

Anyone have an alternative solution? Having the camera not be a child and simply match the player's movement doesn't help, and it also doesn't rotate along with the player when I do that. FixedUpdate, DeltaTime, etc, nothing seems to help.

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

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to limit the angle of a camera with transform.RotateAround? 1 Answer

Quaternion Slerp Sanity Check 1 Answer

Attaching camera to instantiated object 1 Answer

Where can I see rotation value from transform.RotateAround? 0 Answers

Changing The Camera Position & Offsetting LookAt 2 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