magnetic object (actor)

(metafor) #1


have a serious problem. how can i make an object, which
has a magnetic behaviour. more precise, i want that the
user can move around the object in every axes, but can’t fell down and if
there is a curve it should therefore follow this curve.

i tried some workaround with invisible tunnels, but
the result is not really good, the user allways hits
something he can’t see.

perhaps it would work if i could fix my object on a path, but
i don’t know how this works in the game mode, in animation
it’s no problem.

if you have any idea, how i could fix it, i would be really happpy.


(gorgan_almi) #2

not sure what u mean… :-?

(wiseman303) #3

I think I understad, you want a shpere, and a character could walk on it like it was a planet (ie. gravity pointing towards the center, instead of straight down.)

I did some experiments with this, but didn’t have much success. I tried using the track-to actuator, but then my character couldn’t turn.

Here are some ideas that might help you figure it out.

  1. try parrenting a dynamic actor to an empty. Now turn the empty upside down and start the game, what happens? I noticed this effect when I was working on a particle system, but it could be helpfull here.
  2. There’s a script for orienting an object to match the face hit by a ray sensor. do a search on the forums for ‘bullet holes’
  3. instead of having invisible tunnels, you could have an invisible sphere that surrounds the ground sphere, then you wouldn’t be hitting invisible walls all the time.

(metafor) #4

hi wiseman303

thanks for your ideas, i’ll check them out and let you
know if it was succesfull.

For the ones who don’t unterstand me: i’m sorry, english is not my native language, so probably that’s the problem, perhaps not?, so i’ll try to explain my question again.

actually wieseman303 get it, it’s like you could walk on a planet you don’t fall down if you are on the “other” side/hemnisphere. because the gravity works always to the centre of the sphere/planet.

if someone has done some gravity expermients, not just using the bult-in, or did some magnetic kind of behaviour, please let me know, even if it’s not related to it, probably it’s very usefull for me.

(gorgan_almi) #5

I thought ossies just had to hold on! :smiley: :stuck_out_tongue: :smiley:

ok seriously…

If you find that link please let me know its address i could really do wid somethin like that

you’d need to turn natural gravity off and you’d also need a script to keep the player on the surface of the sphere. I was thinking of doin a similar script which emulated the gravitational attraction of large masses for a space simulation once but i never got around to it.

(saluk) #6

If you merely want to get the character to follow a path, which is fairly simple, you can convert the path ipo to an object loc/rot ipo. You have to step through the ipo in the editor and everywhere you want a keyframe, you have to UNparent the object from the path, making sure to keep the transform, add the loc/rot ipo, then reparent it to the path and step through some more. A bit tedious but not too hard.

For a more complicated thing, it could probably work without a script with a lot of work, but it would definately be better with a script. Track to could work, but not too pretty, if you have turning on a seperate object parented to the main empty. A lot of work though…

(wiseman303) #7

OK, I’ve made a quick demo of walking arround a spherical world. This shows ONE way it can be done. It’s not the only way, it may not even be the best way, but it’s easy, and it works.
(It’s in the downloads section.)

(saluk) #8

Nice wiseman:)

(doogs) #9

Well, when ODE is implemented, I think theres a gravitational aspect you can set to any object that is dynamic. I’ve seen the demo for it so it’s got to be possible.


(metafor) #10


wiseman303 i’ll checked out your blender file,
that’s the solution i tried myself it works fine
for a sphere but not for other geometrical forms,
ex. a extruded moebius band.

i’ll just mentioned the sphere, because it’s the
easiest way to unterstand my problem.

imagine a 3D racetrack which you can ride on
every side, something like wipeout 3d.

but anyway thanks a lot. i’ll checkout all mentioned
solutions later this day and post my results to let you
know. for better understanding i’ll prepare a .blend file
for you.

cu > argh have to do some studies now.

(metafor) #11

hi gorgan_almi

here’s the link for the bullet hole script:

hope it helps.


(metafor) #12

me again

i tried to use the ipo-idea from saluk, but i’m not really sure how
i could use this in the realtime engine. in animation mode everything
works fine, perhabs i really don’t get it. :o

at the moment i try something wiseman303 showed me with his
planet simulation. inside my racetrack there is an empty tunnel
in which i put my controlable object. the camera is on top of surface. now
i’m able to rotate around the track but still can’t move forward in the way i
want. you get stuck in the curve of the track, because the wall and the y-achse of the force is exactly in a 90d. angle, so i need do rotate my object around the z-axis, every time it passes a certain point of my curve.

if this solution is succesfull i let you know if you are interested, ok i’ll post it anyway.


(gorgan_almi) #13

Thanks metafor :smiley:

(wiseman303) #14

That’s an interesting problem. Maybe you could use ray sensors on the controllable object to detect when the tunnel is turning, and rotate the object accordingly?

(metafor) #15


very interesting problem, but also quiet boringly. i had the same idea as you mentioned, using sensors. i tried to use invisible planes ->> when object passes plane it’s turned by a certain degree around the z-axis. it works but the effect is not satisfying.

i try to implement your idea with the ray sensor.

otherwise i have to do it with some maths, sinus-curves or something like
that. :-?

last question, how does the dRot work, i’ve read that 36 is a full rotation, that can’t be true, because i have to turn my object by 0.02 otherwise it spinns like hell. if i divide my curve in twelfe segments the object should rotate exactly 180degrees around the z-axis->> 15degree per segment, this should be 1.5 in blender’s dRot-> why not?


(metafor) #16

have a look at the .blend file perhaps someone knows how to solve my problem in a really easy way.

i use ray sensor to detect the point of rotation but seems to be quiet tricky.

thanks a lot.

(Pooba) #17

I was trying a kind of magnetic thing just a second ago, and i was using 2 objects, 1 had the controls and the movement forces, and the other one had a track to acuator that tracked to an obect in the center of the screen and did a force toward that. I the one with the controls and forces parented to the one that tracked to. All I really need is to have the 2nd object copy the location of the 1st object, because otherwise they get out of place.


(nikolatesla) #18

dRot is in radians. All rotations in gameBlender are radian measure.

360 degrees = 2pi Radians.


(gorgan_almi) #19

and you can use pi in blender…

import math

print math.PI