Forward vector on contact

Hi,

I think I have found my problem but not exactly why and therefore what the solution is.

Basically I have a character controller that can collide with a cube kinematic rigid body.
If it collides on the cube which has it’s forward direction the same as the character controller everything is ok (i.e. character goes north and hits collider; both bodies forward is north).
But if I connect with the cube from any other side the axis appear incorrect when I attempt to move the cube.
I assume my problem is with :

character.transform.parent=bodyhit.transform;

i.e. my character is the character controller and becomes a child transform of the body it collided with. I think this is where the problems are,yes? - because their forward vectors won’t match???

thanks!

Hi,

Hmmm, perhaps I mis-understand my own problem :slight_smile:

I wish to move a body ‘forward’ but forward via the body that contacts it i.e. the colliders ‘forward’ not the collided with ‘forward’ - does that help ? :slight_smile:

Thanks

Hi,

I think I’ve solved my problem.
Here’s what I do:

ver=0.1f*moveJoystick.position.y;

Vector3 players_forward=p.transform.forward*ver;
Vector3 pos=p.bodyhit.transform.position+players_forward;
p.bodyhit.transform.position=pos;

Hopefully you can see what I was attempting and can verify it’s correct. I realise I need to multiply ver by delay.time aswell.

Thanks again!