 # Zlopez ziztem zcrewin upz

Hi,
I’m making a slope system for The Dawsich’s game, but it’s all screwed up, for a reason I don’t know. It gets screwed up at the middle of the way and each time I press W it changes directions. I’m posting the script and the .blend file.

``````from math import sin, cos, sqrt
import GameLogic as g
c=g.getCurrentController()
o=c.getOwner()

# vector functions
def VEC_length(x):
return sqrt(x*x+x*x+x*x)
def VEC_normalize(x):
length = VEC_length(x)
return [x/length,x/length,x/length]
def VEC_cross(x, y):
return  [x*y - x*y,
x*y - x*y,
x*y - x*y]
def VEC_min(x, y):
return [x - y, x - y, x - y]
def MAT_trackvector(fw, y):
if abs(abs(fw) - abs(y)) &lt; .001: #prevent gimbol lock
y.append(y)
del y
right = VEC_normalize(VEC_cross(y, fw))
up = VEC_cross(fw, right)
return [[right, up, fw],
[right, up, fw],
[right, up, fw]]

sloperay=c.getSensor("sloperay")
hit_norm=sloperay.getHitNormal()

o.setOrientation(MAT_trackvector(hit_norm, [0.0,0.0,1.0]))
``````

### Attachments

slope.blend (135 KB)

Anyone???

There is that alignAxisToVect() function that will align your object to the getHitNormal() function, type alignAxisToVect() into the seach and you will get some threads on using it.

It doesn’t work…
I think I have a game demo with a slope system.

Yea I never actually got it to work but some people have, check out cyborg_ar’s sonic game if you want, he uses it there.

muhahahahaahaha, pm me and i will give you the link (i cant post it here)

¿Hablas español? Yo lo tengo.

Can you please, admin, explain me why does the _______ delete button disappear?
Lol…

I guess you can’t delete it after so long.