Needed: Space Walk Script

Ok so I am working on a blender game where a first person (dynamic) player (as well as npc’s) will need to walk around on large space craft’s that will be moving and spinning without throwing the player off. What I want to happen is for the player to copy the movement of the ship they are standing on as well as the rotation relative to the ship. I have gotten so far as to use a ray to detect the ship but I don’t know how to get its movement. I basically want to parent a player dynamic object to a ship dynamic object so that the player object does not get tossed around by the ship objects movement but can still collide with the ships geometry.
Pleases oh scripting ones tell me what I must do! :wink:
Here is my meager script so far:


#########################################
#            StickyFeet Script          #
#              by  LtJinks              #
#########################################
cont = GameLogic.getCurrentController()
player = cont.owner
ray = cont.sensors["ray"]
Floor = ray.hitObject

P.S. The ship does not need to be a dynamic object but it does need to move.

Anyone? not even any veiws?

View count has never worked for many months. The whole blenderartists userbase may have read your post and you would never ever known.
The best chance for getting a response is to supply as much info as possible, images, blend files, something that makes it as easy as possible for people to answer your question.

Ah, well thanks for letting me know. I was worried I insulted someone somehow.

Well here’s what I’m working with now:


#              SCript                  #
#              LtJinks                 #
########################################

#Define Sdandards
cont = GameLogic.getCurrentController()
player = cont.owner

#Define Sensors
w = cont.sensors["w"]
a = cont.sensors["a"]
s = cont.sensors["s"]
d = cont.sensors["d"]
col = cont.sensors["collide"]
#Define Actuators
Move = cont.actuators["Move"]

#Main
Move.setDLoc(0,0,0,1)
MX = Move.getDLoc()[0]
MY = Move.getDLoc()[1]
MZ = Move.getDLoc()[2]
oloc = player.position
if w.positive:
 Move.setDLoc(MX,0.1,MZ,1)
 MX = Move.getDLoc()[0]
 MY = Move.getDLoc()[1]
 MZ = Move.getDLoc()[2]
 
if a.positive:
 Move.setDLoc(-0.1,MY,MZ,1)
 MX = Move.getDLoc()[0]
 MY = Move.getDLoc()[1]
 MZ = Move.getDLoc()[2]
 
if s.positive:
 Move.setDLoc(MX,-0.1,MZ,1)
 MX = Move.getDLoc()[0]
 MY = Move.getDLoc()[1]
 MZ = Move.getDLoc()[2]
 
if d.positive:
 Move.setDLoc(0.1,MY,MZ,1)
 MX = Move.getDLoc()[0]
 MY = Move.getDLoc()[1]
 MZ = Move.getDLoc()[2]
 
 
cont.activate(Move)
 
if col.positive:
 player.setPosition(oloc)
 print "done"

The player object is a sensor object so it can detect collision. Is there a way to move the player object away from the point it collides with? or any other way to simulate collison with a sensor object instead of a dynamic object?

Its gona use a distance constraint actuator to keep the player hovering 1 unit over the ground so that it can go up stairs and such. However the actuator cannot be alowed to stay active because for some reason the player cannot move while it is activated.

Any luck so far LtJinks?

I cant remember how I came across this thread, but its a similar problem to one I had during space-orientated projects over the years, and I never got around to solving it. Im about to need to solve it properly however.

My old thread here - http://blenderartists.org/forum/showthread.php?t=138620
One of the options I was looking at was magnetic boots, like in this thread on GameBlender, download and test out the .blend there by Raider, youll find you can walk around on all the upper surfaces even if they go upside down. Youd pretty much make a script which makes the character ‘glued’ to the floor. Perhaps even check out one of the games in the last contest Erwin did, I think it came in 3rd place, the one with the snail which could stick to walls and the roof. Find out how that was done.

I dont have the time right at this moment, but Ill try to work on a solution in the next few weeks if no one else gets around to it first.

Here’s a thought…

Maybe you could somehow use the LinV and AngV of the ship. Knowing how far from the axis of rotation the player is, you could work out a vector that the player has to move along to remain motionless with respect to the ship. This would need to be running constantly since the vector would change as the ship rotates.

Knowing the vector of motion required to keep the player stationary you could then hold in memory a vector for player controlled movement that would represent a LinV in the player’s local coordinate. Combining the ship vector and the player vector would give an absolute LinV and AngV that could be applied to the player object.