moving entity with entity

Blitz3D Forums/Blitz3D Beginners Area/moving entity with entity

grindalf(Posted 2005) [#1]
i've made an airship that i can walk around on, but i have problems walking around on it when its moveing, for instance sliding of the back when its moving forward, falling through it when its moveing up, i tryed to fix it like this

tmpx=entityx(character)-entityx(airship)
tmpy=entityy(character)-entityy(airship)
tmpz=entityz(character)-entityz(airship)

moveentity airship,asx,asy,asz

positionentity character,entityx(airship)+tmpx,entityy(airship)+tmpy,entityz(airship)+tmpz



this worked fine if my airship only went forward or forward and down slowly, if i went up i would fall through the ship, if i went down to fast and forward i would slide off the back.
i tryed to do entityparent but it kept messing up the coordinates of my character and my camera would go flying of the terrain.

somebody must know a good way to do this
thanks


GitTech(Posted 2005) [#2]
Apply the movement of the airship also to the character? So, if you move the airship 10 units on the x-axis:

MoveEntity airship,10,0,0


Then you also move the character 10 units on the x-axis:

MoveEntity character,10,0,0



grindalf(Posted 2005) [#3]
that only works if the character and airship face the same direction though. i want to be able to walk around on the airship


GitTech(Posted 2005) [#4]
Have a look at the TFormVector() command. IIRC, you can use that command to "TForm" a vector for the spaceship to a vector (in the same direction) for the character. Then you can use TFormedX(), TFormedY() and TFormedZ() to move the character with the spaceship.


grindalf(Posted 2005) [#5]
thanks i'll try it


PowerPC603(Posted 2005) [#6]
Or you could make the player a child of the airship.
This way, if the airship moves, so will the player.

CompleteAirship = CreatePivot()
EntityParent player, CompleteAirship
EntityParent airship, CompleteAirship


This code creates a pivot, makes the airship a child of that pivot and makes the player a child of this pivot.
You can still move the airship and the player separately.

If you want to move the airship AND player: MoveEntity CompleteAirship, x, y, z
Then the airship moves and the player moves with it, direction of the player doesn't make a difference.