Rolling ball - Texture question

0 favourites
From the Asset Store
High quality sound effect pack, in the following categories: Dark, Mystical, Peaceful
  • I'm wondering how I would make a texture on a rolling ball so it seems to be 3d.

    For example in the game of Pool. When you shoot the cue ball at the eight ball.

    <img src="" border="0" />

    I my case it would be a 2d top view of the table but if this effect would work, the game would look more natural instead just moving some circles around the table.

    Any thoughts?

  • I'm not at home to check C2's capabilities, but methinks the way to do this would be to have an sprite detector, and on top of that have a tileable background with an "unwrapped" ball texture and display it at an offset based on the balls movement. But then to make the tileable background a round shape... need another brain for that one.

  • Any thoughts?


    I was making a game for "Reclamation" contest till I went crazy and formatted my PC with all files including capx.

    If it is effect you are looking for, just make an animation of rolling texture and manipulate it with angles.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok, this is exactly the effect I'm looking for. It really looks nice btw :) Still not quite sure how to set it up.

  • It looks like animated frames by Blender3D or some 3d editor. You can make a sphere, then apply a texture, then render and get animated frames, it's easy.

  • Still not quite sure how to set it up.



    Sprites are generated using 3d software. And in Construct 2 animation speed is constrained to ball's velocity. If you use physics or other mechanics, just calculate ball's speed and set it as animation speed.

  • Kastas

    I like your example.

    Have been trying to change it to physics behavior because it is much more real when it comes to, well Billiard physics (back bounce of rail and what not).. :)

    There is no option to get pure speed from the physics behavior, just X and Y Velocity.

    I tried to use the custom movement behavior along with the physics to get the speed but it doesn't read the physics.

    What I would to do is to have the ball react naturally when it hits the rail, texture vise.. It will probably take more events then the bullet behavior thingy. Was a bit surprised how easy that was btw. :)

  • Now I have been trying to get this to work properly, not successful!.

    Anyway, here is a cap.

    Why can't i make the animation go faster without the whole thing lagging?

    Why can't i use really high animation speed, like 100-200. Do i need to change the sprite's time factor or what?

    Also, I'm trying to figure out the best way to make the texture react "real" when it bounces back from the wall. The animation always plays the same way though the "cue stick" hits it from another angle.

  • So I wanted to bump this.

    I found out that it is not possible to use animation speed with a physics sprite, it stops and well just doesn't work.

    So the best way regarding that is to have a physics sprite working as a placeholder for a another sprite that will have all the texture movement and what not.

    But still, I haven't found a good way to make the ball roll realistic regarding speed and when it bounces back from the bumper.

  • Sorry for deleting the last post, but I thought of something else to check, and it made my post inaccurate.

    Anyways... good news is that what I came across here, makes what I was trying to accomplish a lot easier.

    You can calculate angle of movement and then apply force to adjust for the object it is colliding with. Like if a cue ball hit a bumper you could apply additional force with the angle of movement.

    Here is a pic of my event:

    <img src="" border="0">

    Here is how I calculated the angle:


    I apply force in the direction my object is moving on collision and it gives my object an extra boost.

    At least, I think this is what you are looking for.

    Hope it helps.

  • eski, I assume when you say 'make the ball roll realistic', you are talking about just the texture? (which should be another sprite attached to the physics ball).

    You should set the animation speed to:

    someConstant * distance(0,0,velocityX,velocityY)

    where someConstant is a number. You will have to play with it until it looks natural.

    You will also need to set the angle of the image to

    angle(0,0,velocityX, velocityY)

    (That is assuming the rolling ball animation is rolling to the right).

    Hope that helps! Be sure to ask me with sqiddster if that doesn't work as I often lose topics like this :P

  • sqiddster

    I tried your solution but it is still a problem.

    This only works if the ball is rolling horizontal. Please check out the cap to see what I'm talking about.

    I don't have a clue how to fix that.


    There you are.

    You missed the point where I said

    "You will also need to set the angle of the image to

    angle(0,0,velocityX, velocityY)".

    I also took the liberty of adjusting 'rolling' to around the correct amount, so the animation looks accurate.

    Nice idea with the ball shine, you are going to have to do something about picking the other balls, if you want multiple shines/ball animations. I'd assign a 'baseUID' or something instance variable for each of the shines/animations, then apply their events only repspective to the ball of that UID.

    Hope I helped!

  • sqiddster

    It's getting there. I actually tried the other thing as well but forgot to change it back. The only problem there is that the ball is changing angle every time it stops. It would be awesome if it was possible to make it stay at same angle.

    What I'm going after is the movement like in this game.

    Maybe it isn't possible with this engine?

  • That looks like a 3D engine, so no, this isn't possible.

    The example I gave is the best you'll get. You can stop the ball from changing angle when stopped, by adding another condition to check that both X and Y velocities aren't 0 before adjusting the angle.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)