Any way to Simulate 3D ball movement in a 2D game using SpriteKit?

2d, 3d, sprite-kit

Solution

You could use a 3D animation package like (Maya, 3DSMax, modo, Cinema4D etc.) and animate a ball rolling (plan or side elevation depending on your view). Also depending on your ball pattern you could keep the frame count pretty low, maybe 15frames. You would then render the frames out as a series of PNG files `Ball_0001@2x.png, Ball_0002@2x.png, Ball_0003@2x.png`, put them in an atlas and assign them to an SKSpriteNode using `SKAction`. There are various things you can do within Sprite Kit to modify the animation, Ease-in, Ease-out on `SKActions`, altering the frame time on the `SKAction` when you set up the animated sequence to speedup/slowdown the animation. If you happened to be using paths to control the movement of the sprite you can also do follow path to align the animated sprite to the direction of travel. These might not help directly, but they might give you some ideas that point you in the right direction.

EDIT:

To use a small number of frames you would need to specify that the animation repeats for as long as you need it to. Also think carefully about the pattern on your ball, in the example below if your viewing the ball moving from the side (and its rolling to the right) then you only need to render frames for the ball rolling 120deg. So if you roll it 120 (in 15frames) then repeat the animation 3 times you will get 360deg roll (45 frames) but only using 15. If you make the pattern even smaller then you can reduce the roll amount, reduce the frames needed and increase the repeats then you come to setup you SKActions.

Problem

I am wondering if anyone is aware of a way to simulate a ball for example moving in 3D in SpriteKit (a 2D framework). Like if a soccer ball is rolling, or a stripped pool ball, or even a baseball with the red stiches. I think 2D treatment of this sort of thing makes it look like it moves around on a sheet of ice instead of a realistic rolling behavior. That works for objects like a hockey puck, but not for a realistic roll of a ball. Any thoughts on doing this would be great. I have played games that get this to work and the devs claim to be using a 2d engine. The most recent that I can remember is Miniclips Pool game. They claim to have used Cocos and it is a 2D game if I recall correctly from an article I read.

Original source