How do you make a Player Stand on a moving object?

Blitz3D Forums/Blitz3D Programming/How do you make a Player Stand on a moving object?

WightNight(Posted 2004) [#1]
I searched around the forums, but can't find anything about how to make a player move around independently on another moving object (say a boats deck). The player could be in both first and third person mode. I'm guessing, but would I move the boat in one direction and then move the player in the same direction? Any ideas?


_PJ_(Posted 2004) [#2]
This is prolly not the best way to do it, but Im sure it'd work and it's how I'd approach the problem:

CHECK IF player TOUCHING object
IF SO:
ENTITYPARENT player,object
ENDIF

IF NOT:
UNPARENT player,object

(Depending on your style of game, this should work for a player jumping/ falling running etc. Also, it won't matter at which point they collide with the ship's deck...


Rob(Posted 2004) [#3]
Or use the mighty tokamak.


Shambler(Posted 2004) [#4]
I do a linepick down and parent the player's pivot to any entity immediately below it or unparent it if there is nothing below.

I did this in SARE engine and it worked a treat for lifts,it even rotated the player if they were on a rotating platform and it all worked seamlessly.

If the player is jumping or falling then unparent them.


bradford6(Posted 2004) [#5]
do you want the player to be able to 'walk' around the boat?


jhocking(Posted 2004) [#6]
Look in the Toolbox for Nuclear Glory collision detection.


WightNight(Posted 2004) [#7]
Yes, I want the player to walk around on the boat. Would the EntityParent/LinePick method or Nuclear Glory allow this? I'm trying to avoid physics;)


eBusiness(Posted 2004) [#8]
Do something like; in every loop: playercollide=EntityCollided(player,object type)

When you move an object that the player might stand on, check if playercollide=objecthandle, if so, move the player along. It's a bit more difficult if you rotate the object, but as far as you call yourself "integraldragon", you better be able to do a bit of trigonometry yourself. Hope it helps :)


mrtricks(Posted 2004) [#9]
I'd do it with parenting, until the player is not colliding with the boat any more.


jfk EO-11110(Posted 2004) [#10]
Shambler - could you post a simple example in de code archives? Sounds good!


Shambler(Posted 2004) [#11]
Hmmm bit too hard to rip that out of the engine since it relies on many other things in the engine =/

Would have to write something from scratch, will see if I get the time...


WolRon(Posted 2004) [#12]
Parenting/unparenting would not be perfect however.

I can think of many scenarios where it wouldn't look correct.

Imagine if the player is riding in a speed boat.
The player decides to jump straight up into the air.
In reality: the player would continue to follow the motion of the boat and land only slightly behind where he started the jump (due to wind resistance).
Parented the whole time: the player would continue to follow the motion of the boat and land exactly where he started the jump.
Unparented once jump began: the player would move up as the boat would swiftly ride forward out in front of him.

Probably best to keep the player parented or use a physics system.


Shambler(Posted 2004) [#13]
This could be overcome by adding the boats velocity to the players velocity at the moment of jumping and unparenting.


mrtricks(Posted 2004) [#14]
What he said. :)