POV-Ray : Newsgroups : povray.off-topic : Vector math question.. : Re: Vector math question.. Server Time
7 Sep 2024 03:23:36 EDT (-0400)
  Re: Vector math question..  
From: scott
Date: 25 Aug 2008 02:43:20
Message: <48b25488$1@news.povray.org>
This should work, it totally negates the direction of the wind force if 
hitting the "front" of the object.

objnorm = VecNorm(GetRot);
dot = wind.x * objnorm.x + wind.y * objnorm.y + + wind.z * objnorm.z;
if dot < 0
   wind = -wind;
SetForce (wind);

Or did you want only the component of the wind perpendicular to the wall to 
be negated?

if dot < 0
   Wind = wind - 2 * dot * objnorm;

Or did you want the component of wind perpendicular to the wall to be zero 
(as I think John explained)?

if dot < 0
   Wind = wind - dot * objnorm;


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.