How can I make an object attract another object?

I want to make a racing game somewhat in the style of F-Zero. In F-Zero, the racers can move around cylinders upside down. I’m not entirely sure how to explain it, so here’s a link to video showing the race course that best demonstrates what I want to do (I’m not the one racing by the way):

I have an idea on how to do it. I could set the global force to zero and then put a downwards force of 9.8 on each object I want affected by gravity when the object falls off the race track. However, I was wondering if there was a simpler way. Thanks.

Does anyone have any ideas? I figured out that if I can get the bottom of the racer to track to a point directly beneath it inside the course, then I could make a sort of anti-gravity for it. Unfortunately, I can’t find a way to get the bottom of the racer to track to a point beneath it as that point would have to constantly move with the racer too.

I have now found a really simple solution to my problem. While looking through the various actuators that might help me, I saw the constraint actuator. I’ve never used it before so I had no idea to use in the first place. I looked up what it does just to see if it might help, and I found that the distance constraint was just what I was looking for.

I don’t know how I missed this thread (the title is a bit misleading), but here is what I was doing before I changed my racing game to full 3D flight!

Its a bit old and tatty but it uses your constraint method and also there is a Python equivalent for you to look at (both do the same thing, roughly). I also use servo motion too (just press UP to move), but I hope it helps (retrospectively). This Python script was given to me but I cannot remember who wrote it (sorry!).

And good luck with your racing game! I’ve been working On mine for about a year (and learning Blender as I go).

The track is angled to test slipping, so don’t think the camera is at a funny angle!



EDIT Blast! Agoose beat me to the finish…!


defy_gravity.blend (497 KB)

Sorry about the misleading title, but I couldn’t figure out how to explain my problem (probably why no one responded until now). Thanks for the input though.