POV-Ray : Newsgroups : povray.binaries.animations : POVigma: I just can't get it right! : Re: POVigma: I just can't get it right! Server Time
18 Apr 2024 20:27:56 EDT (-0400)
  Re: POVigma: I just can't get it right!  
From: Le Forgeron
Date: 28 Aug 2015 12:46:08
Message: <55e09050$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Le 27/08/2015 21:45, "Jörg \"Yadgar\" Bleimann" a écrit :
> #if (ballpos_next.x > xmin & ballpos_next.x < xmax & ballpos_next.z
> > zmin & ballpos_next.z < zmax) #declare dir = 360-dir; #declare
> hit=1;

* that's seems to detect a pinball's hit: ball hitting a nail on its
center.

* 360-dir is not the opposite direction.

hitting a bumber to get the opposite direction: dir = (dir+180)%360

You should detect walls' hit, and there is horizontal walls and
vertical walls. Both are harder to handle with a single dir variable.

Horizontal wall, reflecting the vertical component.
Vertical wall, reflecting the horizontal component.

Assuming 0 is North, 180 is South, 90 is East.

Horizontal wall: 0->180, 180->0, 90->90, 270->270, 30->150, 80->100

Vertical wall: 0->0, 180->180, 90->270, 270->90, 30->330, 80->280



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iJwEAQEIAAYFAlXgkFAACgkQhKAm8mTpkW3rVwQA2xzfj0wn+y9SZH5esqtsx2Nj
Ers/qjqcM1z8Qqos8sD1Bso/a0WFCw8zWiUlmKmp1NzIrOrk9QmPOhd3Q5PSz8WM
+mza/TTofD6I84W4ktgOGcjOxs+er98vSOPM4NGBNLvns9d7yKdIyxhgRyjprKO2
MmCxvKDxsX61PqWZz1Q=
=kJMo
-----END PGP SIGNATURE-----


Post a reply to this message

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