x


Rigidbody move Character Controller

So I want to be able to have "certain" rigidbodies that collide with my charactercontroller to cause the character controller to move. I know that it kind of...defeats the purpose of using a character controller in the first place, but I would really just like to add some code on top of that to make it work, as opposed to making an entire rigidbody based charactercontroller. Thanks

more ▼

asked Jul 11 '10 at 01:18 AM

Kith gravatar image

Kith
541 27 28 38

Usually I get a lot of answers to my questions from this community, but as of late no one has been answering my questions :-. Is it because they're stupid questions lol?

Jul 11 '10 at 11:06 PM Kith
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Apply rigid body to your character and add this code for the object which is going to destroy and make effects for character.

//Apply a Player Transform to choose the character transform.

if (Vector3.Distance(player.transform.position, transform.position) < 15) { // Make player die HealthController hc = player.GetComponent(); hc.health = 0;

        // Make player fly into the air
        CharacterController cc = player.GetComponent<CharacterController>();
        cc.Move(((player.transform.position - transform.position).normalized * 15 + Vector3.up * 5) * Time.deltaTime);
    }
more ▼

answered Jul 27 '10 at 06:37 AM

karthik gravatar image

karthik
96 7 7 10

(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:

x1862
x1080
x549
x9

asked: Jul 11 '10 at 01:18 AM

Seen: 2729 times

Last Updated: Jul 11 '10 at 01:18 AM