0

i am a newbie in cocos3d. I wan to draw a line using cc3linenode.

Here is the code

float arr_location[] = {x,y,z, dx,dy, dz };
CC3LineNode* lineNode = [CC3LineNode nodeWithName: @"Line test"];
[lineNode populateAsLineStripWith: 2
                         vertices: arr_location
                        andRetain: YES];
lineNode.color = ccGREEN;

[_lines addObject:lineNode];
[_activeWorld addChild:lineNode];

But when i try this, i get an error like this

Instance method populateAsLineStripWith: vertices: andRetain: is not found(return type defaults to 'id')
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Karan Alangat
  • 2,154
  • 4
  • 25
  • 56

1 Answers1

4

did you import?

#import "CC3ParametricMeshNodes.h"

you error gives you unfound instance of method, so you just need to make right import with that method

found answer here

proof screenshot

p.balmasov
  • 357
  • 1
  • 16
  • k. But cc3line node is a type of mesh node. so what else i ve to import ?? – Karan Alangat Jun 04 '13 at 08:31
  • yes i found this method in CC3ParametricMeshNodes, two screenshots of using this [method](http://imgur.com/zv1Gs2N), and from what [class](http://imgur.com/KNQbb7q) it is – p.balmasov Jun 04 '13 at 08:45
  • another issue comes tat is type compatibility. vertices needs cc3vector type arguments. But i ve given **float**. SO i changed type of ** arr_location** to **cc3vector** type. Still i get warning . . . – Karan Alangat Jun 04 '13 at 08:51
  • look this [example]https://github.com/cocos3d/cocos3d/blob/master/Demos/CC3Performance/CC3Performance/Classes/CC3PerformanceScene.m#L161 – p.balmasov Jun 04 '13 at 08:56
  • But i ve found small prob. How to assign values for vertices. I tried using cc3vector array. But still confused about the positions of line. – Karan Alangat Jun 05 '13 at 11:44