projectile interval problem

Ok, I’ve used projectile intervals before with no problems but I’m having a slight problem here. We’re making a tank game and when the tank hits a collision polygon (in front of a ramp, for example), a “jump” animation gets called on the tank, which is essentially a projectile interval. A jump dummy node is parented to the tank (in front of it) which is used as the end position of the interval.

The problem is that after each jump, the tank doesn’t go all the way back to the same vertical position, specifically Z = 0. It ends up floating in the air, around Z = 1.5 something. And on EVERY jump it gets a little higher. I’m stumped.

Here’s the tank getting initialized:
(all in the tank class, self.model is the tank model)

        TANK_START_POS = Point3(-107.8,21.4,0) 
        TANK_START_HPR = Vec3(-270,0,0)

        # set the position and hpr

Here’s the jump dummy node getting made:

        TANK_JUMP_DISTANCE = 150

        # dummy node used for jumping
        self.jumpDummyNode = loader.loadModel("models/sphere.egg")

and finally the jump function:


    def jump(self, collisionEvent):

        # set the jumping boolean to true
        self.isTankJumping = True

        # turn off the dust particles

        # get the endPos
        endPos = Point3( self.jumpDummyNode.getNetTransform().getPos() )

        # set up the jump interval
        self.jumpInterval = ProjectileInterval(self.model,
                                               endPos = endPos,
                                               duration = TANK_JUMP_DURATION)

        # do the jump, then reset the jumping boolean
        Sequence( self.jumpInterval, Func(self.resetIsTankJumping) ).start()

    # end jump

Any ideas? I’m really stumped here.

Thanks in advance,


I bet your endPos netTransform() is not the value you think it is. Why don’t you print it out as you’re setting up each ProjectileInterval? My prediction is that you’ll see the Z offset there.


I found the problem.

Since I’m using a collision segment to detect collisions (i use segments instead of spheres because of high speeds), I’m getting multiple jumps in a row (I forgot to disable jumping while the tank is currently jumping).

Once I turned off multiple jumps at once, my problem was fixed.

Thanks for the quick responce though david :smiley: