King Popsicle
King Popsicle

Reputation: 465

How to make a cube in cocos3d

I am working on an iphone App using cocos3d and I want to render a cube

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

I have tried this but populateAsSolidBox: no longer exists. How can I programmatically create a simple box or cube in the latest cocos3d 0.7.2? Thankyou

Upvotes: 1

Views: 542

Answers (2)

user9527
user9527

Reputation: 315

CC3BoundingBox bounds = { {-1, -2.0, -2.0}, {0.0, 0.0, 0.0} };
CC3MeshNode *cube = [[CC3MeshNode alloc] init];
[cube populateAsSolidBox:bounds];

I cannot use makeBounds function, these are codes I use in cocos3d 0.7.2

And, remember importing CC3ParametricMeshNodes.h

Upvotes: 0

Ken Toh
Ken Toh

Reputation: 3751

The populateAsSolidBox method (along with a number of other populateAs methods) are now defined in ParametricShapes, a CC3MeshNode extension. This is in CC3ParametricMeshNodes.h.

So just be sure to import that header file in your Scene.mm:

#import "CC3ParametricMeshNodes.h"

Upvotes: 1

Related Questions