I’ve been around many searches and have not found something gives me any real new direction. Tried posting this last week but I don’t think my question was faaaarrrr too open ended.
I have a character with a rocket pack which can fly in any of the 8 directions (up, up-left,down-left etc) when he flys diagonally into a wall I’d like him to ricochet off based on the angle he hit. The character gamObject has a rigidbody and sphere collider and bouncy physics material with no friction. All the floor walls and ceiling have physics materials set to bouncy and no friction.
I don’t seem to be getting how the vector3.reflect should be working. This is what I have:
Example of making the character move
curVelocity : Vector3;
function FixedUpdate()
{
rigidbody.velocity = Vector3(1*flightSpeed,1.5*flightSpeed,0);
curVelocity = rigidbody.velocity;
}
How I’m currently setting up the collision
function OnCollisionEnter(other : Collision)
{
if (other.collider.tag == "wall")
{
for (var contact : ContactPoint in collider.contacts)
{
curVelocity = Vector3.Reflect (curVelocity, contact.point);
velocity=curVelocity;
}
}
}