playMaker

Author Topic: Jump Pads?  (Read 5407 times)

terrymorgan

  • Junior Playmaker
  • **
  • Posts: 65
Jump Pads?
« on: July 29, 2012, 03:17:58 PM »
I'm trying to make a jump pad (not necessarily with playmaker) for 1st person character controller with charactermotor, like the 3rd person "Lerpz"
tutorial on the unity tutorial area, you collide with it and get boosted in y. (up).  My search came up with
this script

//jump_pad2.js

#pragma strict


var moveVelocity : Vector3 = Vector3.zero;

private var thePlayerMotor : CharacterMotor;

function Start(){
    thePlayerMotor = GetComponent(CharacterMotor);
}

function OnTriggerEnter(WhatHitMe : Collider){
    if (WhatHitMe.gameObject.tag == "JumpPad"){
       moveVelocity = Vector3(0,50,0);
       thePlayerMotor.SetVelocity(moveVelocity);
    }
}


I have a flat rectangle (made a Tag 'JumpPad') with a larger box collider (is_trigger) and the script attached to it, but nothing
happens when I jump on it. Anybody know what I'm missing here? An FSM would be overkill  I think.

Playmaker noob tuts:
http://terrymorgan.net/playmaker/playmaker.html

shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: Jump Pads?
« Reply #1 on: August 02, 2012, 03:44:30 AM »
I don't code but a jump pad with playmaker shouldn't be too hard using collision and rigidbodies,  adding y force when char collides with your jump pad.

Horror

  • Junior Playmaker
  • **
  • Posts: 79
Re: Jump Pads?
« Reply #2 on: August 02, 2012, 04:10:41 AM »
^ Hell yeah! I haven't written any code for my game. FSMs all the way  ;D

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Jump Pads?
« Reply #3 on: August 02, 2012, 08:18:12 AM »
I am not sure what is going awry with your script (i'm not the best coder) but here's a question...

for the jump pads, do you want to make it so that it preserves the momentum and prevents you from being able to control the movement while in the air? or do you want to have some level of control while in the air (such as seen in games like Mario, Megaman and a lot of other commercial games?)

because there would be two ways to do this... the first would be just creating a trigger event that adds a force to the object that it's colliding with (which you can then go further to tell it only to affect the object if it has a particular tag or if it is the player character itself.) this would get you upwards momentum to get that sort of effect...

the second would be a little more complex where you'd have to add in your movement control FSM a system to determine if the controller is grounded and if it is not and transition between the two of them with the appropriate actions... then having the controller that controls the motion set up so that if you're in the air, you can still move the character (though maybe restricting it so that it doesn't move as fast.) you shoudl be able to preserve the momentum you have while it's airborne but i've not tested that one yet... i'll do so and see about what i can come up with (since i'm also seeking out how to get a decent jumping mechanic which is similar enough in practice as a jump-pad mechanic.)

terrymorgan

  • Junior Playmaker
  • **
  • Posts: 65
Re: Jump Pads?
« Reply #4 on: August 02, 2012, 08:27:34 PM »
This is the one from the 3rd person Lerpz platformer, it's made for a special 3rd person controller, I think
it has a rigidbody, which would make it easier, probably the way I'll go. It takes me a couple of weeks to
get 'programmy' which won't be anytime soon. The idea is if I'm running at the platform, I'll be propelled
into the air, still moving forward. I also need a 'vertical only' jump for ladders. Why is Unity so puny in
these fundamentals?

var jumpHeight = 5.0;

function OnTriggerEnter (col : Collider)
{
   var controller : ThirdPersonController = col.GetComponent(ThirdPersonController);
   if (controller != null)
   {
      if (audio)
      {
         audio.Play();
      }

      controller.SuperJump(jumpHeight);
   }
   
}


// Auto setup the script and associated trigger.
function Reset ()
{
   if (collider == null)   
      gameObject.AddComponent(BoxCollider);
   collider.isTrigger = true;
}

@script RequireComponent(BoxCollider)
@script AddComponentMenu("Third Person Props/Jump pad")

terrymorgan

  • Junior Playmaker
  • **
  • Posts: 65
Re: Jump Pads?
« Reply #5 on: August 04, 2012, 10:52:07 AM »
couldn't find a jump pad, but this ladder one works, character controller doesn't use character motor, but FPS walker with ladders,
and 'use ladder', guess I could just delete the character motor script.




http://xn--m3h.net/umbrella/2010/11/unity3d-ladders/

http://dl.dropbox.com/u/1939589/Ladder%20Example%20Project.zip
85MB

this guy's a terrific artist, check the January blog