Hello again...
thank you for the help. Everything is moving along rather well. Will post back when I have the code done as to give back at least something to all that will eventually have problems with Bezier

as I did.
But for now, I am looking for the following :
I have a bezier curve, but I want the object to move above it, something like the image here :
http://www.esentiali.com/iphonesdk/001.png. Let me explain.
I have the curve working (almost), but the issue is as following. In order to get the bike from the start of the curve to move above the curve (like A,B,C) I enlarged the frame of the Image and left some transparent space below the bike (see D) so the center of the image is on the curve, but visually the bike is moving above the curve. If I don't create the extra transparent space, I get the unwanted result (see E).
The A,B,C,D method is fine, until I need to detect collision, obviously since the area of the image is way too big. I though of 2 workarounds :
1. Clone the path (which will be invisible) and let the small (normal) image move on it, but I don't know how to clone the path so that the bike moves corectly, since the invisible curve has to be different than the original.
2. Create a collision Rect in the Bike Rect and detect collision of that, but can't get this to work either.
Now the structure is as follows. In my ViewController I create a UIView which contains the following :
Code:
bike = [CALayer layer];
bike.bounds = CGRectMake(0, 0, 40.0, 40.0);
bike.position = CGPointMake(p01_1.x,p01_1.y);
bike.contents = (id)([UIImage imageNamed:@"bike.png"].CGImage);
[self.layer addSublayer:bike];
bikeCollision = [CALayer layer];
bikeCollision.bounds = CGRectMake(0, 0, 15.0, 9.0);
bikeCollision.position = CGPointMake(p01_1.x-7,p01_1.y-20);
bikeCollision.contents = (id)([UIImage imageNamed:@"bike_collision.png"].CGImage);
[self.layer addSublayer:bikeCollision];
//I animate both layer along the path and I get the Rect like this :
CGRect bikeCollisionFrame = [(CALayer*)[bikeCollision presentationLayer] frame];
It works like this, but the bikeCollisionFrame is on the path, now if I want it above it I tried adding the bikeCollision not to the view but as a SubLayer of bike, so that it moves together with the bike when it is animated , but I can't get it's Rect (more like I can get the Rect , but it is not moving).
Code:
bike = [CALayer layer];
bike.bounds = CGRectMake(0, 0, 40.0, 40.0);
bike.position = CGPointMake(p01_1.x,p01_1.y);
bike.contents = (id)([UIImage imageNamed:@"bike.png"].CGImage);
[self.layer addSublayer:bike];
bikeCollision = [CALayer layer];
bikeCollision.bounds = CGRectMake(0, 0, 15.0, 9.0);
bikeCollision.position = CGPointMake(20,10);
bikeCollision.contents = (id)([UIImage imageNamed:@"bike_collision.png"].CGImage);
[bike addSublayer:bikeCollision];
//I animate ONLY the bike layer along the path and I get the Rect like this :
CGRect p = [bikeCollision bounds];
CGRect bikeFrameRect = [[self.layer superlayer] convertRect:p fromLayer:bike];
NSLog(@"bikeFrameRect pos.x : %.1f, pos.y : %.1f",bikeFrameRect.origin.x,bikeFrameRect.origin.y);
But here the Log shows no position change, probably due to the fact that I animate the bike layer, which is the container layer for the bikeCollision layer, and for some reason the parent is animated and the child is not.
PS, my animation script :
Code:
anim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
anim.path = bezierPath_1.CGPath;
anim.rotationMode = kCAAnimationRotateAuto;
anim.repeatCount = 1; //HUGE_VALF;
anim.duration = animDuration;
[bike removeAllAnimations];
//[bikeCollision removeAllAnimations];
[bike addAnimation:anim forKey:@"race"];
//[bikeCollision addAnimation:anim forKey:@"race"];
I might have gone the wrong way. Could someone help or point me in the right direction ?