Working with Torque...

I have a game concept (here’s a .gif for your perusal):

'twas made in another engine, but because of marshmallows, I decided to convert it to Blender.
I have started the process.

The sphere was controlled through Torque, because I want to have several different surfaces with different friction values, so the sphere would slide irritatingly, adding to the challenge.

I have trouble working with torque in Blender, though. The commands seem to not respect the local/world orientation.

The following lines are present (minus the obvious cont/scene/owner and keyboard input inits):

if keypressed in [up]:
if keypressed in [down]:
if keypressed in [left]:
if keypressed in [right]:


The ball is a RigidBody, as I found it nice to work with.

The ball moves correctly only if up and down are pressed, as soon as I try to turn it, all movement gets weird. No good.
Logic bricks work good, like good things work, but I’d like to code this thing like a raging rod of burning love. Also, control on braking, because the slowdown speed needs to be a bit higher.

I think some problems might have to do with me failing to connect the angular speed, that I also tried to use, prevented by the use of logic bricks. I use the angular speed to initialize x and y (to control the ball speed), but that makes stuff even weirder, like the ball constantly accelerating…

Is there a primer on how to set up Torque and use it? I’ve been looking, but google points me out to topics I’ve read but don’t help or the Torque game engine…

Okay, so here are my findings.

  • applyTorque() is a way to make objects rotate, as you know. I don’t see what was wrong with your method above; I thought that you had the X and Y values wrong, except that it’s working on object rotations, so that’s correct. applyTorque is a force function, like applyForce() (I think), which is generally more of a slow build-up than plugging in the values yourself into the angular velocity variables / functions.

  • applyTorque() seems to not be influenced by material friction, so you can’t use that to slow down objects’ rotations. I think it’s because the forces are added, and friction just works for movement, not for rotation. Since you use applyTorque(), the ball always rotates unless you change the torque amount. It would seem that a torque of [0, 0, 0] is discarded (i.e. added to the object’s torque, which doesn’t change it).

  • You can use obj.worldAngularVelocity (or localAngularVelocity) to control objects’ rotations, as well. This method affords you more control, since you can directly set the angular velocity of the object. Try uncommenting the obj.worldAngularVelocity line, and commenting the applyTorque() line, and compare the difference (the worldAngularVelocity version moves a bit faster, but it also accelerates quicker, almost like a platforming character).

  • You can do some easy custom friction with obj.worldLinearVelocity (and I’d assume for the local and angular variants) to slow objects down to a stop. Since the object stops moving, applyTorque won’t make the object roll (unless the additive force is greater than friction, I’d suppose).

Anyway, here’s a blend file.

TorqueTest.blend (473 KB)

You have provided a solution (you are some sort of legendary, really). Some code I have a lot of trouble decoding, though. You truly master this craft!

I have made this tiny example:torquing.blend (472 KB)
For some reason, I have answered my own predicaments in this example, it seems. i guess simplifying made it work.

You see how the ball slides over the plane, if you suddenly move direction? That’s what I’m looking for. Apparently, I got it. Though I don’t think this is the ideal programming.

Ok, first off, I would use a dynamic “center” and then have it be ghost, and then attach the “ball” to it, now forces and linear motions on the Center, roll the ball predictably yet efficiently,

added .blend ~28 minutes later…)


Ballz.blend (547 KB)

Another update:)
Added prettyness


TripBallz.blend (1.42 MB)

join my team :slight_smile:


TripBallzStrobeAlpha.blend (1.61 MB)

Added wall climb and jump mechinism
and eye candy

Thanks for the numerous examples, BPR. Some of them are quite nice to look at.
I don’t think I made myself clear, and I apologize for that. So I’ll try to correct such fault.
Moving the ball is easy, making it respond to other bodies is simple, and adding bling is not that important for the time being.

I’ve been toiyng with this idea for ages now, and decided to make a ball game with an entirely different gameplay. You control the ball not by resorting to force (pushing it, like Marble Blast/Ballance), but using the ball’s own rotation to control it, thus making the control more “cerebral” and making the controller actually anticipate where and how the ball will move depending on the friction values between itself and the various surfaces it will encounter.

Your movements are great, but friction values are negated, and I don’t really want to slap into code the way the ball should handle here and there.

Either way, I think that for now the problem is solved. Though I don’t really feel good with the solution.