POV-Ray : Newsgroups : povray.newusers : Follow the bouncing object : Follow the bouncing object Server Time
15 May 2024 07:43:04 EDT (-0400)
  Follow the bouncing object  
From: Bald Eagle
Date: 22 Mar 2014 06:22:48
Message: <532d6478$1@news.povray.org>
I've got an object (a door) that I invoke as the result of a macro - 
Door (Room, Open)
the door frame is labeled with the room number "Room", and the door is 
rotated/opened around the hinge by the degrees defined in the Open variable.

This works smooth as butter in the include file.
I'm not sure about the syntax of invoking this macro in the scene 
multiple times with translations

	Door (Room, Open) translate <x,y,z>   ?

I tried that, and it gives me an error,
	" Parse Error: No matching } in 'union', object found instead "

brute-force pasting the guts of the macro (the frame object and the door 
object plus the text of the door number) works just fine.

Fine meaning that the SDL runs, and I get a rendered scene, but I dunno 
where my door is.

I have a big scene, a sub-scene included in it, and an include file with 
objects I'm defining.

The door is grabbed from the include file (ideally.  right now it's guts 
are hard-pasted into the sub-scene) and then the subscene is "pasted" 
into the big scene via
	#declare subscene = union {#include "subscene.inc"}
	object {subscene rotate y*90 translate <19*8*Feet, 0, 7*8*Feet>}

So I figure that my door ought to get translated by <19*8*Feet, 0, 
7*8*Feet> just like everything else in the scene.

Knowing that I get lost in CSG-space without my Braille map, I took a 
cylinder that stands up on the origin, which the door hinge rotates on, 
defined it as an object, and figured I could send the x, y, and z of the 
min_extent to the debug stream and find out where my door ended up.

So in my include file I have
	#declare Ping = cylinder { <0, 0, 0>, <0, 100, 0>, 0.01 texture 
{pigment {Yellow} finish {ambient 1}}};

in my subscene, I have

object {Ping}
		#declare P = min_extent(Ping).x;
		#declare Q = min_extent(Ping).y;
		#declare R = min_extent(Ping).z;
		
		#debug concat ( "Door Hinge origin = ", str (P, 0, 1), ", ", str (Q, 
0, 1), ", ", str (R, 0, 1), ", ", "\n")

and then right after I actually call the subscene into the big scene, I
#debug concat ( "Door Hinge TRANSLATED = ", str (P, 0, 1), ", ", str (Q, 
0, 1), ", ", str (R, 0, 1), ", ", "\n")
again.

I get all zeros.  Actually, I get -0.0, 0.0, -0.0  .

I'm thinking I'm losing my Ping data because the location gets cleared 
when the include file "exits" and min_extent doesn't give me what I'm 
looking for...?


Post a reply to this message

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