I’m sorry if this question is already answered before, but I can’t really figure out how to do this. I have a Projectile script that handles movement:
public Vector3 directionVector = Vector3.forward;
public virtual void ProjectileUpdate() {
transform.Translate(directionVector * Time.deltaTime * speed);
}
Now when this projectile triggers with something else, I’m trying to achieve a reflect effect, although I’m not really sure how to do this. Currently I’m just changing the direction to Vector3.back:
public override void ProjectileCollision(Collider trigger)
{
if (trigger.GetComponent<PlayerStats>().reflectiveShieldIsActive)
{
hasBeenReflected = true;
directionVector = Vector3.back;
return;
}
}
I’m not sure how the Vector3.Reflect method works, since I can’t find a lot of information about it. How can I achieve a mildly realistic reflect effect? Thanks in advance!