I am developing a board game using Ball
, in cocos3d
. In that I've given an action in touchevent
. I'm printing the location to the console using NSLog()
.
Here is the code
-(void) touchEvent: (uint) touchType at: (CGPoint) touchPoint {
CCActionInterval *BounceAction1=[CC3MoveTo actionWithDuration:0.1 moveTo:cc3v(0.0, -5.0, -0.7)];
switch (touchType) {
case kCCTouchBegan:
[Ball runAction:BounceAction1];
NSLog(@"Location of x=%f and y=%f", Ball.globalLocation.x, Ball.globalLocation.y );
break;
}
Here, 'Ball' is a MeshNode
. It's location is at origin cc3v(0.0, 0.0, 0.0)
.
When I run and touch, I find the ball moving to the specified position. But I get the Ball's location as:
Location of x=0.000000 and y=0.000000
When i touch again, i find the ball is not moving (as it has already moved to the specified location). But then it shows Ball's location as:
Location of x=0.000000 and y=-6.000000
Why I can't find the location the first time?