我想在 cocos3d 中创建一个带有boundingvolume的CC3MeshNode。我创建了一个带有 pod 文件的CC3MeshNode 。我想收到有关碰撞的通知。
-(void) initializeScene
{
[self addContentFromPODFile: @"hello-world.pod" withName:@"pod1"];
CC3MeshNode *object1 = (CC3MeshNode*)[self getNodeNamed: @"pod1"];
CC3MeshNod *object2=[[object1 copyWithName:@"pod1"]autorelease];
[object1 populateAsSolidBox:CC3BoundingBoxMake(9.5, 5.0, 4.0, 0.0, 0.0, 0.0)]; object1.location=cc3v(-5.0, 0.0, 0.0); object2.location=cc3v(5.0, 0.0, 0.0);
[self addChild:object2];
CCActionInterval *move1=[CC3MoveTo actionWithDuration:3.0 moveTo:cc3v(-1.0, 0.0, 0.0)]; CCActionInterval *move2=[CC3MoveTo actionWithDuration:3.0 moveTo:cc3v(1.0, 0.0, 0.0)]; [object1 runAction:move1];
[object2 runAction:move2];
}
-(void) updateAfterTransform: (CC3NodeUpdatingVisitor*) visitor
{
if([object1 doesIntersectNode:object2])
NSLog(@"Collision !!!!!!!!!!!!!!!!!!!!!!");
}
我试图分配boundingvolume,但没有奏效。实际上我在为cc3MeshNode实现 boundingvolume 时很困惑