move to object

Blitz3D Forums/Blitz3D Programming/move to object

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Just trying to help, hopefully it will.

Local MoveZ#
For S.Settler = Each Settler
    If S\Job = JOB_MOVE    ;I use all capitals when referring to those sort of things
        S\DstX = S\X - Order_X
        S\DstY = S\Y - Order_Y
        S\DstZ = S\Z - Order_Z
        OrderMagnitude# = Sqr(S\DstX*S\DstX+S\DstY*S\DstY+S\DstZ*S\DstZ)
        S\DstX = S\DstX / OrderMagnitude
        S\DstY = S\DstY / OrderMagnitude
        S\DstZ = S\DstZ / OrderMagnitude
        AlignToVector S\Picker,S\DstX,S\DstY,S\DstZ,3,1  ; you're moving with a Z speed, so align it to the Z axis (3)

        If MoveZ > OrderMagnitude Then
            MoveZ = OrderMagnitude
        Else
            MoveZ = 2
        EndIf

        MoveEntity S\Picked,0,0,MoveZ
        
        S\X = EntityX(S\Picker,True)
        S\Z = EntityZ(S\Picker,True)
    EndIf

    S\Y = TerrainHeight(Terrain,S\X,S\Z) * 128 + 1
    PositionEntity S\Picker,S\X,S\Y,S\Z,True
    PositionEntity S\Image,S\X,S\Y,S\Z,True
Next


I think the problem with yours is that 1. you're aligning the entity to the X axis and 2. you're not getting the delta of the positions.

Just a guess, though, I'd have to see the problem in real-time to understand properly.