Console.log position of object that is wrapped within a group?


#1

Hello,

I have several objects that are wrapped in a group(group A). Group A is then wrapped within another group(group B)

I’m trying to get the position of one of the objects within group A by logging it to the console log.

At the moment I have this:

function myRepeatingFunction() {

console.log("Object position = " + object8Position);

}
//call myRepeatingFunction every 2000ms (2 seconds)
Z.every(2000, myRepeatingFunction);

This works but the numbers don’t change. I’m guessing as they are contained within a group.

Any ideas on how I can change this?

Thanks

Simon


#2

Hi Simon,

All objects have position values independently but if they are in a group and you are moving the group, rather than the object, then that object will stay at 0,0,0.

In your example, what exactly is object8Position? Feel free to post an example and we can take a look.

George


#3

object8Position is a variable that I created that holds the position of my object.

I’m basically trying to “spawn” another object from the one that I’m trying to obtain the location from if its possible. I thought I may be able to create a loop and have the spawn object appear from its location.