Parkour System?

Hey,

I want to create a simple FPS Parkour System. I have a capsule which has a Character Controller with simple Controls. Now if the capsule stands in front of an obstacle tagged “Obstacle” and the player presses Space i want the capsule to slide over the obstacle. But i don’t know how to achieve it.

I hope you can help me :slight_smile:

Greetings
BusterBlader

This is called Behavior!
This is many lines of code in Unity3d, In other game engines this is more simple.
As first use Locomotion, which is developed by Unity3d Support Team and you can use for feet animation.
As second use Head Look Controller, which is also developed by Unity3d Support Team and you can use for head animation.
For the rest of behavior If you have money to spend I suggest you to buy “Character System v2”
This is the intro video and this is the complete showcase.
If you need more help, let me know.

Or if you are using Unity 4, you could follow the mecanim tutorial, which I believe covers something similar enough to get you where you want.

Thanks…but…i think you didn’t understand what i want to achieve. I don’t want to animate anything. I just want to let the capsule slide over the obstacle like in many other FPS Games :wink:

If you don’t want to use mecanim, that’s fine. Just watch the mecanim tutorial for its use of triggers (ignore the animation bits), you’d want something similar.
Basically put a collider trigger in front of whatever obstacle you wish and whenever the player enters the trigger, set some flag that allows for moving over the obstacle, and set the flag to false when exiting the trigger.

//ObstacleTrigger.js
function OnTriggerEnter (other : Collider) {
   var player = other.GetComponent("Player") as Player;
   if(player != null) {
      player.crossableObstacle = this.transform;
   }
}

function OnTriggerExit (other : Collider) {
   var player = other.GetComponent("Player") as Player;
   if(player != null) {
      player.crossableObstacle = null;
   }
}
//Player.js
var obstacle : Transform;

function Update() {
   if (obstacle != null  Input.GetKeyUp( KeyCode.Space )) {
      // code to face the direction of obstacle, determine it's height, and move the camera over
      //or whatever
   }
}

This is kinda the wrong way to think about making these systems. The better way is to have your characters motion driven by the animation and the players inputs and characters relation to their environment control which animations to play. So for example you would have a run animation and a vaulting animation. When the player pushes the joystick it plays the run animation and the characters position is directly updated from this animation and when the character is close enough to an object it can vault your system then switched to the vault animation and your characters position is driven by that animation instead. Games like this are usualy built with quantised environments, so for example you would build all your obstacles to match a small set of pre-determined heights and widths and you would have a vault animation set up for each. Alternatively you could build several vault animations for low, medium and high vaults for example and then blend between them to achieve the desired vault height.

Thanks Democre :slight_smile: But the thing i don’t know how to do are the motions of the capsule.

The capsule collider is handled specifically in the mecanim tutorial.

Thanks :slight_smile: I’ll try mecanim tomorrow :wink: It’s 10pm over here

Yeah “nullstar” is right, I said Locomotion System and Head Look Controller System because is the best way to start to create something own. But now there is also Mecanim, which is complete of anything.

Oh sorry :smile: Haven’t seen nullstars post :wink: Yeah i checked Mecanim and tested the Example Scenes :smile: I really like it and i think it’s the stuff i need :smile:

See The Script:

var Hand : GameObject;
var UpPlataformName = "";
var CanUpPlataform1 = false;
var CanUpPlataform2 = false;
var CanDoubleJump = false;
var Range = 1.5;
var canTranform = false;

function Update () {

var hit : RaycastHit;
var Direction = transform.forward;

if(Physics.Raycast(transform.position, Direction, hit, Range)){
if(hit.collider.gameObject.tag == "Up1"){
CanUpPlataform1 = true;
}

if(hit.collider.gameObject.tag == "Up2"){
CanUpPlataform2 = true;
}

if(hit.collider.gameObject.tag == "Untagged"){
CanDoubleJump = true;
}

}

if(Input.GetKeyDown(KeyCode.Space) CanUpPlataform1 == true){
transform.position.y += 1.5;
transform.position.z += 0.5;
audio.Play();
CanUpPlataform1 = false;
}

if(Input.GetKeyDown(KeyCode.Space) CanUpPlataform2 == true){
transform.position.y += 0.7 ;
audio.Play();
CanUpPlataform2 = false;
}

if(Input.GetKeyDown(KeyCode.Space) CanDoubleJump == true){
canTranform = true;
transform.Rotate(0, 180, 0);
if(canTranform == true){
transform.Translate( 0, 5, 0);
transform.Translate(0, 0, 10 * Time.deltaTime);
}
audio.Play();
CanDoubleJump = false;
}

}

function OnCollisionEnter(col : Collision){
canTranform = false;
}

if you like Use this

use it for audio:

http://www.mediafire.com/?0z6q9hdfxpkn0ur

OBS: I’m Brasilian and I have a bad english

u say : can create parkour system with mecanim ?

wow your script is cool Matheusfig but the scripts deactivate when pressing one time on the space . Please help its the closes script that almost work for the obsticle game :frowning: