3D Rolling ball with box2d in cc

Hi, How can I create 3D (look like 3D) rolling ball with Box2d in cc ?
I found this video but the author did’t explain how to implement.

He just said :

You can determinate x rotation by the change in x position divided by the circumference.
y rotation is determined by the change in y position divided by the circumference.
z rotation uses real 2d rotation.
If you use quaternion you simplify life

1 Like

Looks like the ball is rendered in 3D, author’s point is about how to calculate 3d object rotation based on movement of box2d object

Hmmm, maybe, but everything in video is 2d except balls!!
So if the balls are 3D it means that there is no way to implement rolling ball in cc!!
Am I right??

My guess is he is using a sprite sheet in combination with node rotation. Shadows would have to be placed on top of the ball.

But I would actually like to know how he does this too.

Also I think he used some view projection eq. that convert flat uv coordinate to spherical coordinate.

There is a glRenderSphere.cpp file in open solution in the vid :slight_smile:
I think easiest way to draw a textured sphere in Creator would be by applying a pixel shader to empty quad. Tricky part (as you mentioned) would be mapping spherical coordinates to texture UV, but there should be a lot of info on this problem around the internet

:grinning: Great!!

Yes I think so. But the problem is that I’m not familiar open gl shader but I know HLSL.
And another problem is that I do’t know how to use GL Shader in cc.
:thinking::thinking::thinking:

But would this even be possible to do in CC? I don’t think the necessary properties are accessible.

I think creating pixel shader in cc is possible.

As far as I can see Shaders are not even in the pipeline yet. https://trello.com/c/xap9n4ri/55-shader
But I’d like to know how to do them if possible.

A few months ago @owen announced some new 3D capacities coming to Creator, but there was no time frame I believe. So, maybe next year?

you probably hit the wrong nickname =)

Yeah, I did =)
Thanks for the heads up!