WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Grouping Objects from SightLab in Vizard (https://forum.worldviz.com/showthread.php?t=6449)

josie_icoglab 12-02-2025 02:44 PM

Grouping Objects from SightLab in Vizard
 
I am creating a 3d flanker task using sightlab and vizard. I added the environment and objects (flanker and target arrows) in sightlab, and am now finetuning the trials and manipulating the positioning of arrows in vizard.

I want to link the 4 flanker arrows as a group so they move as one from trial to trial, as they will always be manipulated in the same way at the same time per trial. I am a beginner with python and don't have much experience coding. I tried to use the sightlab AI to create code to do this, but was unsuccessful. This is the code that sightlab VR assistant gave me:

#position flankers and target at same depth and height:

import vizfx

#group flankers so they move and rotate as one, keep target separate:

flankerNames = ['L1_group', 'L2_group', 'R1_group', 'R2_group']
targetName = 'C_group'

flankerArrows = [vizfx.addChild(name) for name in flankerNames]
targetArrow = [vizfx.addChild(targetName)]

flankerGroup = vizfx.addGroup()

for arrow in flankerArrows:
arrow.setParent(flankerGroup)

#arrange flankers and a target in a line

spacing = 0.4

positions = {
'L2': -2*spacing,
'L1': -spacing,
'R1': spacing,
'R2': 2*spacing,
}

for arrow in flankerArrows:
arrow.setPosition(positions[arrow.getName()], 0, 0, mode=viz.REL_LOCAL)

#position of flankers relative to participant
depthZ = 2.0
heightY = 1.5
centerX = 0

flankerGroup.setPosition(centerX, heightY, depthZ)
targetArrow.setPosition(centerX, heightY, depthZ)

#face participant
flankerGroup.setEuler(0,0,0)
targetArrow.setEuler(0,0,0)

The error code I am getting is: AttributeError: module 'vizfx' has no attribute 'addGroup'.

Just wondering if anyone has any idea how I could group objects as one, or how to adjust this code so that it runs?


All times are GMT -7. The time now is 10:27 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC