# legal thingamagigs

Hello.

Some friends and I are working on making a 1st person puzzle game like myst, but walking like Unreal Tournament. I am rapidly finding out that logicbricks aren’t really what I want, also; I get ice-skating effects and I can’t climb an incline of more than 15 degrees or so. Squish the Bunny is almost exactly what I want for walking around, but I don’t know if I can just steal the python script and just give recognition in the credits and that can be that, or what else I’ll need to do.

Could I get some legal advice? If anything, could I borrow some insight as to how I’d go about making a normal walking model? If anyone’s interested, I whipped this up in a very short ammount of time, so don’t scream too loudly about how bad it looks :

http://www.atthelibrary.com/3d/walkPenguin.blend

Thanks,
-Greg

P.S.: By the by, the controls are wasd with arrowkeys and tab for 3rd person

there are other mouse scripts here that ought to work too

or, hell, you need a specific one many people here can write it.

I have one which I created for a racing game (which I didn’t get the controls working too well on, and haven’t messed with for a while) which I may adjust some to a fps view and post

I like mine because you don’t have to have multiple objects for the two axes of rotation, it rotates one object using setOrientation

I guess it is a bit involved the setup for this one (must set the properties right for one)

``````# rotate the linking object depending on how the mouse moved
# also, constraints for rotation around on x axis (can limit how far can look up/down)
#
# setup:
# link to mouse movement sensor
# give object these properties:
#  Timer: now =  0.0
#  Float: ago = -1.0
#  Float: sx  =  0.0
#  Float: sz  =  0.0
#  Float: cx  =  1.0
#  Float: cz  =  1.0
#
#### NOTE ####
# the rotation is based on global axes, so this is not suitable
# directly for a camera, it could be modified for one though,
# probably involving only changes to the last 4 lines (o.setorentation...)
#

import GameLogic
import Rasterizer
from math import sin, cos

midx = Rasterizer.getWindowWidth()/2
midy = Rasterizer.getWindowHeight()/2

# move the cursor back to the center
Rasterizer.setMousePosition(midx, midy)

c = GameLogic.getCurrentController()
mouse = c.getSensors()[0] # change to specify name of sensor if you connect multiple sensors to this script
o = c.getOwner()

# initilization
if o.ago &lt; 0.0:
Rasterizer.showMouse(0) # hide the cursor
Rasterizer.setMousePosition(Rasterizer.getWindowWidth()/2, Rasterizer.getWindowHeight()/2)
deltax = 0
deltay = 0
else:
deltax = midx - mouse.getXPosition()
deltay = midy - mouse.getYPosition()

# based on the cursor's movement, and the constraints, rotate this object
# (and how much time passed)

dt = o.now - o.ago # dt = time passed to this frame
o.ago = o.now

#o.setOrientation([ \
#	[1.0, 0.0, 0.0], \
#	[0.0, 1.0, 0.0], \
#	[0.0, 0.0, 1.0] ])

# create copies of the values, then calculate the new ones
## z axis rotation (no constraints)
osz = o.sz
ocz = o.cz
zrot = (3.141592654 * -0.10) * dt* deltax # adjust non-pi constant for sensitivity
szrot = sin(zrot)
czrot = cos(zrot)
o.cz = -osz*szrot + ocz*czrot
o.sz =  osz*czrot + ocz*szrot

# x axis rotation (there are constraints)
osx = o.sx
ocx = o.cx
xrot = (3.141592654 * -0.10) * dt* deltay # adjust non-pi constant for sensitivity
sxrot = sin(xrot)
cxrot = cos(xrot)
o.cx = -osx*sxrot + ocx*cxrot
o.sx =  osx*cxrot + ocx*sxrot

if o.cx &lt; 0.0: # prevent looking past top or bottom
o.cx = ocx
o.sx = osx

o.setOrientation([ \
[  o.cz, o.sz*o.cx, o.sz*o.sx ], \
[ -o.sz, o.cz*o.cx, o.cz*o.sx ], \
[    0,     -o.sx,    o.cx   ] ] )
``````

the specified properties will rotate the object as if rotation would be cleared on it, if you care to mess with them the sx cx sz cz are the sine and cosine of the rotations around those axes

and I have a .blend