Game Development Community

Climbing

by Shane Culliton · in Artist Corner · 06/30/2004 (8:07 am) · 4 replies

I would like my charactor (a monkey) to be able to climb drain pipes, ladders, etc...
Using trigers I am able to change the charactor from a walk sequence to a climb sequence.
However i am unable to get the charactor to move upwards off the ground:

below is an example of the code i am using:

datablock TriggerData( ClimbDrain1 )
{
        tickPeriodMS = 100;
};

function ClimbDrain1::onEnterTrigger( %this, %trigger, %obj )
{
	echo( "The player has just entered a climbable area!!!");

	// need to modify physics data to counter gravity...
        
        // if(inputKey = w ) move-up
        // if(inputKey = z ) move-down 

        // HOW ????

	Parent::onEnterTrigger( %this, %trigger, %obj );
}

function ClimbDrain1::onLeaveTrigger( %this, %trigger, %obj )
{
	echo( "The player has just left a climbable area!!!");

	Parent::onLeaveTrigger( %this, %trigger, %obj );
}

function ClimbDrain1::onTickTrigger( %this, %trigger )
{
	echo( "The player is still in a climbable area!!!");
		if (player.moving)
		{       
			%player.playThread(0,"climb");       
			alxPlay(AudioProfilePlayerClimb, x,y,z);
		}
	Parent::onTickTrigger( %this, %trigger );
}

Any help would be great!
Thanks.

#1
06/30/2004 (8:37 am)
In script only, your only option would be impulse i think.
#2
07/01/2004 (12:43 am)
Impulse? What's that!
#3
07/01/2004 (5:10 am)
ApplyImpulse

Often used with explosion or radius type damage. Allows you to apply and impuse (you could think "push") and object or player.

An example of use from radiusDamage.cs file
// Apply the impulse
      if (%impulse) {
         %impulseVec = VectorSub(%targetObject.getWorldBoxCenter(), %position);
         %impulseVec = VectorNormalize(%impulseVec);
         %impulseVec = VectorScale(%impulseVec, %impulse * %distScale);
         %targetObject.applyImpulse(%position, %impulseVec);
      }

My guess for climibing is that you would have schedule multple impulses to constantly push the player up and keep him from falling back down.
#4
07/01/2004 (6:22 am)
Or how about a physical zone with no gravity?

just an idea