x


how can i make my character bounce without a rigidbody

im trying to make a simple game that my character (a ball) bounce around the world

  1. i add my character movearoud
  2. i add a bounce physic material to my platform

when i play my game it doesnt work until i add a rigidbody to my character but when i did that my character start jumping like crazy here is my movearoud script

private var dead = false; var speed = 6.0; var rotateSpeed = 3.0; var bullitPrefab:Transform; var lifeTime = 1.0;

function LateUpdate() { if(dead)

 {
   

if(dead) { transform.position = Vector3( 0,4,0); dead = false; } }

}

function OnControllerColliderHit(hit : ControllerColliderHit) { if(hit.gameObject.tag == "fallout") { dead = true; //substract life here

              HealthControl.LIVES -= 1;

}

}

function Update () { var controller : CharacterController = GetComponent(CharacterController); // Rotate around y - axis transform.Rotate(0, Input.GetAxis ("Horizontal") rotateSpeed, 0); // Move forward / backward var forward = transform.TransformDirection(Vector3.forward); var curSpeed = speed Input.GetAxis ("Vertical"); controller.SimpleMove(forward curSpeed); if(Input.GetButtonDown("Jump")) { var bullit = Instantiate(bullitPrefab,GameObject.Find("spawnPoint").transform.position, Quaternion.identity); // shoot the bullet at 10m/s bullit.rigidbody.velocity = transform.forward 50;

} }

@script RequireComponent(CharacterController)

more ▼

asked Oct 02, 2011 at 04:38 AM

thepra13 gravatar image

thepra13
-16 54 50 54

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

1 answer: sort voted first

use the code button, if you can!

Basically, every time your object collides with the object you want it to bounce off of, just move it accordingly. Use an easing function of some kind.

more ▼

answered Oct 02, 2011 at 06:06 AM

Catlard gravatar image

Catlard
771 190 143 193

To be honest, it's pretty hard to do without rigidbody physics...

Oct 02, 2011 at 06:10 AM syclamoth
(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:

x9517

asked: Oct 02, 2011 at 04:38 AM

Seen: 1408 times

Last Updated: Oct 02, 2011 at 06:10 AM