x


Getting Unity to notice I'm jumping without a character controller?

Hi, I have an issue in which I have 3 parts to my character:

-Main Camera -Plain of Animation (For the sprites I am using) -Plain of Animation 2 (For lerping)

Now what I want is that for the plains to be able to recognize when I am jumping or not. I tried to put a character controller on one of the plains (When the group selection "player" already has a character controller and a movement set) and all it did was, well screw up everything. Is there a way for me to access the character controller in the main group or to have a character controller on? Or is their a way to know the same way without the controller but with just scripting?

Thanks in advance.

more ▼

asked Mar 13 '11 at 03:03 PM

Tentor gravatar image

Tentor
2 2 3 3

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

i'm not quite sure what you want to do but I think you want an animation to run when you jump? Try something like this:

var CanJump = true;

function Update () { if(Input.GetButtonDown("Jump") && CanJump) { rigidbody.AddForce(Vector3.up * JumpSpeed); } } function OnCollisionStay(collision : Collision)

{ if(collision.gameObject.tag == "floor") { CanJump = true; Stop.Animation(); } }

function OnCollisionExit(collision : Collision)
{
    CanJump = false;
    Play.Animation();   }
more ▼

answered Mar 21 '11 at 02:31 PM

ian 1 gravatar image

ian 1
1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5077
x672
x109
x59

asked: Mar 13 '11 at 03:03 PM

Seen: 961 times

Last Updated: Mar 13 '11 at 03:03 PM