Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

liptonlover

macrumors 6502a
Original poster
Mar 13, 2008
989
0
I'm working on learning core animation right now, though it's hard since everything I find is complicated demonstrations and not tutorials. Anyways, I'm doing well enough, but I want to know how to move an object on all three axis. I can't figure out AT ALL how to move an object of any sort in any direction. Help? And while you're at it if you know of any core animation tutorials other than apple documentation that would be great. Thanks!
 
I'm working on learning core animation right now, though it's hard since everything I find is complicated demonstrations and not tutorials. Anyways, I'm doing well enough, but I want to know how to move an object on all three axis. I can't figure out AT ALL how to move an object of any sort in any direction. Help? And while you're at it if you know of any core animation tutorials other than apple documentation that would be great. Thanks!

Your probably looking in the wrong places. This is more of a maths question rather than a programming question. What have you tried?

Edit : Here you go:

http://developer.apple.com/document...nimation_guide/Introduction/Introduction.html

All you need.

Edit 2 : And this is the specific page which deals with exactly what you are looking for.

http://developer.apple.com/document...es/Layers.html#//apple_ref/doc/uid/TP40006082
 
thanks!
And what I had found was CGPoint, but I have no clue how to use it so I googled it, and I still couldn't find anything helpful. Thanks again!
 
ok that brings me to hopefully my final question. How do I set up a new "instance" of a struct and use it? I don't have much experience with structs, all I did was read about how to use them. I know what they do and all that and I can use one in plain C but not in concert with cocoa/obj-c.
Thanks again for your help and all these links!
 
Code:
CGPoint point;
point.x = 100;
point.y = 100;

Structs work like integers or floats. They don't work like classes. Your best bet is to look at some of the drawing examples that ship with Xcode.

BTW: I responded to your post yesterday and included the link to the new Pragmatic Programmers book about Core Animation.

Best of luck
 
ok so the code you just posted will create a CGPoint called point, with x and y values both equaling 100 right?
Now how do I use those points? I can't find a function like [[layer animator]location:point];
or anything like that.
Finally, what about zlocation? Is that just a third field in the struct? Can I just do point.z=[];?
 
ok so the code you just posted will create a CGPoint called point, with x and y values both equaling 100 right?
Now how do I use those points? I can't find a function like [[layer animator]location:point];
or anything like that.
Finally, what about zlocation? Is that just a third field in the struct? Can I just do point.z=[];?

No, read the reference for CGPoint. It is for 2D only.

I posted the reference material that explained what you need to do. It is maths you need to do, so you need to translate the objects using the functions in one of the links I posted above.
 
Sorry forgot about the links you gave me. I gotta go now but I'll read through them tomorrow.

I'm kind of curious though... why is math involved in translating that CGPoint into movement of an object? I don't get why you said that at all... :confused:
 
I'm kind of curious though... why is math involved in translating that CGPoint into movement of an object? I don't get why you said that at all... :confused:

Because anything to do with 3D in programming is just trigonometry, matrices and vectors basically.

Yes, maths does have some uses - wish I had paid more attention in my school maths lessons now when I was younger but there you go, hindsight and all that.
 
I know programming involves loads of math usually, but don't forget core data is 2.5D not 3D :p and it certainly isn't involved in what I want to do right now.
 
you're just full of links aren't you :D
Well now that I can stick around I'm going to read the appl doc before asking another question..... maybe. Questions are just such a nicer and easier way to learn for me :rolleyes:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.