x


Phisics question! How can I launch this object?!??!?!?!!

XXXXXXXX SOLUTION FOUND, WAS JUST TO ZERO THE VECTORS XXXXXXXXX

I have an almost done script here, it works almost fine but when I launch the model its behave isnt what I expect.

works this way: the object has this script attached and my character, when collide with its child collider is able to pick it up, it does work well, and then, he is up to launch it but the physics isnt work the way I want.

here it is:

I was reading about possible solutions for this issue, one of then is probably "Force.Impulse" other is "vector3.normalize".

since 22 days ago I knew about nothing about programming, I really dont know how to appy it, can anybody help with this??!??!?

thanks alot in advance!

 var playerHand : Transform;

 var pegou = false;

 var soltou = false;

 var upforce = 6000.0;

 var frontforce = 3000.0;





function OnTriggerStay (other : Collider) {



if(other.transform.tag == "Player"   && Input.GetButton("Fire1")){

    pegou = true;

    timeDelay = 0;

 }

    }



    function Update() {



    if (pegou){



    var colisorzao = transform.parent;

    colisorzao.parent = playerHand;

    colisorzao.rigidbody.isKinematic = true;

    colisorzao.rigidbody.detectCollisions = false;

    colisorzao.position = playerHand.position;

    colisorzao.rotation = playerHand.rotation;

 }

 if (pegou && Input.GetButton("Fire2")){



pegou = false;

timeDelay = 0.0;

soltou = true; 



}



if(soltou){



colisorzao = transform.parent;

colisorzao.rigidbody.isKinematic = false;

colisorzao.rigidbody.detectCollisions = true;

transform.parent.rigidbody.AddRelativeForce (0, upforce , frontforce);

colisorzao.parent = null;



}

}



function segurar () {

 return pegou;



}



function soltar (){

 return soltou;

}
more ▼

asked Nov 11 '10 at 06:19 AM

Fubiou gravatar image

Fubiou
30 12 12 15

Please format your script properly.

Nov 11 '10 at 09:25 AM Fishman92

I am a complete noob on this, sorry.

Nov 11 '10 at 06:15 PM Fubiou

btw

"collisorzao" means Big Collider, "Pegou" means "held" Segurar means "hold" , "soltar" means "release"

Nov 11 '10 at 06:54 PM Fubiou

Because this question has been answered (by yourself), please post an answer with your solution, and mark the answer as accepted. This will show that this question does no longer need a solution, and will allow for more questions to be answered. Thank You!

Nov 12 '10 at 12:13 AM BinaryCaveman

Also, programming is in english, always in english, one of the first things I learned in my programming class was to always use english terms because it's not made for any other language...

Nov 12 '10 at 05:12 AM Justin Warner
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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:

x3727
x3325
x1787
x140
x51

asked: Nov 11 '10 at 06:19 AM

Seen: 1007 times

Last Updated: Nov 11 '10 at 10:44 PM