Creator3D 如何计算反射?



reflect ( incident: Vec2, normal: Vec2 )//求反射角
{
//反射方向的计算公式: reflect = incident - 2 * dot(incident, normal) * normal
const dotProduct = Vec2.dot( incident.normalize(), normal );
const reflection = incident.subtract( normal.multiplyScalar( 2 * dotProduct ) );
return reflection;
}
3赞