# Getting values out of a vector Array.

 02 February 2011 PerfectLine Expert   Casey C Benn Venice , United States Getting values out of a vector Array. So I stored a vector array of all the distances of vertices from an initial origin point. vector \$averageDist[] = {<<0,0,0>>}; It starts out with only one value in the array [0] being 0,0,0. As I run my "for loop" I add each vector, which is the x,y,z in distance from the origin point, to the vector array. I end up with one vector for each point I have selected. So the list ends up being this when I print it. -0.31992 0.616774 1.341836 -0.319918 0.616774 -1.341836 -0.532443 0.616774 -0 0.060095 -0.035267 1.218362 0.060098 -0.035267 -1.218362 0.532441 -0.616774 1.064887 0.532443 -0.616774 -1.064887 0.363782 -0.616774 -0 Now, how I can get an individual value out of this array? When I try to do print \$averageDist[3]; I do get the proper result 0.060095 -0.035267 1.218362 But if I want to single out say the Y value only I can't seem to get it. print \$averageDist[3].y; // Error: Syntax error // Yet, if I did make a vector that wasn't an array I could get the y in this fashion. What is the method used for getting a single value out of a vector array? Thanks. __________________ AKA KC / Intuition share quote
 02 February 2011 NaughtyNathan HighEnd3D deserter   Naughty Nathan Technical Artist Sony SCEE Liverpool Manchester, United Kingdom this has come up before. and is in the docs but you cannot get a component from an array element, you have to cast is as a temp vector first: ``````vector \$temp = \$averageDist[3]; print (\$temp.y); float \$Y = (\$temp.y); // etc... `````` :nathaN share quote
 02 February 2011 PerfectLine Expert   Casey C Benn Venice , United States Ah, ok. Sorry if I just newb'd up the forum. Thanks for the quick reply. __________________ AKA KC / Intuition share quote
 02 February 2011 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.
Forum Jump
 Please select one User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home -------------------- Gallery     Latest Entries     Featured 2D     Featured 3D     CG Awards     Community Awards Main     News     General Discussion     Off Topic     Recruitment         Temp Job Board Challenges     Rival Crimson X Chaos     Education     Demo Reel     Portfolio Review GROUPS WIP ADVICE     Pro Select     Art Direction and Interviews     New 2D/3D Sketchbooks 2018     WIP 2D/3D & Animation         WIP/Critique: 3D         WIP/Critique: 2D             Speedpaints & Sketchbooks         WIP/Critique: Animation     Partners and Groups         Kitbash 3D Thunderdome         Collaborative Projects Autodesk     Autodesk Maya         Maya Dynamics         Maya Rendering         Maya Character Setup         Maya Programming     Autodesk Miscellaneous         Autodesk MotionBuilder         Autodesk Mudbox         Autodesk Softimage             XSI: Programming             ICE: Interactive Creative Environment     Autodesk 3ds max         3dsMax Tutorials & Tips         3dsMax Resources         3dsMax SDK and MaxScript         Plugins & Add-ons         Particle Flow     Mudbox Featured Gallery ZBrush     Featured Zbrush Gallery     Pixologic ZBrush     Keyshot     Marvelous Designer Texturing     Allegorithmic Substance         Substance Designer         Substance Painter         Substance Featured Gallery     Texturing XYZ     Mari     Marmoset Toolbag Software     Maxon Cinema 4D         Cinema 4D Resources     Side Effects Houdini     Compositing Software         The Foundry Nuke         Adobe After Effects         Autodesk Effects and Compositing         Eyeon Software Digital Fusion     Additional Software         Lightwave 3D             LW Resources             LW Tutorials         The Foundry Modo             The Foundry Time Travel Challenge         E-on Software Vue         Photoshop / Painter         Blender         3DCoat Techniques     Art Techniques and Theories     Digital Matte Painting         Digital Matte Painting Mini-Challenge     Modeling         Modeling Challenge             Member Model Collection     Texturing and Surfacing     Character Rigging     Animation     Lighting and Shaders         Lighting Challenges     Compositing and Editing     Anatomy and Figurative Art         SPOTLIGHT: Best of the Artistic Anatomy and Figurative Art Forum         Tutorials and Workshops         Personal Anatomy & Sketchbook Threads         References, Resources, and Supplies Technical     VR/AR     Master Virtual Reality with BrioVR     Workstation Builds     Game Engine     Graphics Programming     Technical and Hardware
Miscellaneous

All times are GMT. The time now is 02:39 PM.