Traveling around a planet

Ok! So what I am trying to do is to get the yellow tetrahedron to move around the planet so that the z axis of the tetrahedron is always aligned to the normal “force” that the planet pushes on to the tetrahedron. What it does now is slides around with correct planetary gravity though the tetrahedron isn’t always oriented correctly. Also how do I stop it from sliding when I move the tetrahedron. Any ideas?

Controls:
R - forward
F - backward
WASD - move camera
RMB - rotate camera


planet.blend (378 KB)

I think this is what you want.
This is made by a member here, Goran Milovano.

Yes, this is the tutorial I used. My planet is more uneven then his so it is not behaving the way I wanted it to.

Make a thread on nilunder.com.
It’s Gorans site and he’s likely to reply to you there.

in your demo blend there a flag on “collision bounds” -> BOX for the planet (in physic panel)

must unceck this . (object static as default have a triangle mesh already )

after that to align the player to the planet you can using rayCast()
I can post a blend

or, add a property “world” to the planet

and add a script for the player with a sensors always true

this scipt:


from bge import logic

cont=logic.getCurrentController()
own=cont.owner

obs=logic.getCurrentScene().objects
for i in obs:
    if "world" in i:
        ray=own.rayCast(i,own,5,"world")
        if ray:
            own.alignAxisToVect(ray[1],2,0.1)

or too easy, from your blend
1- unceck the collision bounds for planet (physic panel)
2- decrease the -radius- of player to 0.1 (physic panel)