4

I am trying to implement a simple 3d object on the cocos3d template.

Usually you get the object from a POD file or similar.

But what i need is to make it by code in the application.

I have tried CC3BoxNode with CC3BoundingBox. But it isn't what I am looking for.

I need to create something similar to that. enter image description here

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
saimonx
  • 516
  • 1
  • 8
  • 25

2 Answers2

4

Take a look at this example: Bigbot Smash City

Mikael
  • 3,572
  • 1
  • 30
  • 43
  • 1
    in ios5, i got compilation error at the line CC3Layer* cc3Layer = [[Demo3DLayer alloc] initWithColor: ccc4(0x00,0x9a,0xcd,0xff)] autorelease]; in appdelegate and i changed it to CC3Layer* cc3Layer = [[Demo3DLayer alloc] init]; and got it working. hope it will help somebody. Thanks for the example link. – jkr Nov 11 '11 at 09:21
4

Did you try this ?

CC3BoundingBox bounds = makeBounds(9.5, 5.0, 4.0, 0, 0, 0);
CC3MeshNode *cube = [[CC3MeshNode alloc] init];
[cube populateAsSolidBox:bounds];

This is the way the boxes are created in the project cited above. I've been playing around with the project and extracted the code to draw just a simple box like this :

Simple cube display with Cocos3D

Cheers,

yonel
  • 7,855
  • 2
  • 44
  • 51