- Home /
Question by
MrReborn121 · Jan 16, 2014 at 03:38 PM ·
heighthigh
Change Jump height in certain area?
How can I make my character jump higher when they are in a certain "Zone" or coords. of the map? Preferably zone. I am using the CharacterMotor.js in the Character Controller, that comes with unity.
Thanks, MrReborn121
Comment
Answer by MFen · Jan 16, 2014 at 03:49 PM
Create a cube that contains the Zone. Turn off the renderer. Select trigger in the cube collider. On a script create a class
void OnTriggerEnter(Collider c)
{
c.gameObject.getComponent<jumpScript>().jumpAmount = newAmount;
}
void OnTriggerExit (Collider c)
{
c.gameObject.getComponent<jumpScript>().jumpAmount = oldAmount;
}
Add this script to the cube that contains the zone.
How can I do this with the Character$$anonymous$$otor.js script?
No, I mean do I put Character$$anonymous$$otor.js for or what goes there?
Ins$$anonymous$$d of "jumpScript" it would be Character$$anonymous$$otor