x


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.

more ▼

asked Apr 22 '12 at 02:50 AM

Blackjackjulian gravatar image

Blackjackjulian
36 1 2

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2987
x2156
x1274
x327
x87

asked: Apr 22 '12 at 02:50 AM

Seen: 442 times

Last Updated: Apr 22 '12 at 02:50 AM