Hi computer genius! I have one small question. I write a script (flying.js). He must to disable the “DragRigidbody” script, when my Character Controller collide with object cube (Tag “kyb”). Cube must fall but he didn’t. Sorry for my english I know, his worse then my grand mather :lol: .Please try drag the cube collide with him. And biggest question, what’s wrong with my script :?:
flying.js
var disabler : DragRigidbody;
function Start()
{
disabler = gameObject.GetComponent(DragRigidbody);
}
function OnControllerColliderHit (hit : ControllerColliderHit)
{
if (hit.gameObject.tag == "kyb")
{
Diss();
}
}
function Diss()
{
disabler.enabled = !disabler.enabled;
}
225245–8125–$111_2_210.rar (1.55 MB)
Any tips guys? Please! It’s very important.
In the Diss function try using:-
disabler.enabled = false;
…rather than flipping its value with the ! operator. Lots of quick collisions can happen one after another and could enable the DragRigidbody again.
Thank’s for your atention andeee!
I know that I write very badly, and I can not convey their thoughts. Plese forgive me.
This disabler.enabled = false; work. But. The’r small problem. If i touch cube, I try to drag him, nothing going on (good). If i touch cube when he is in air when I drag him, he doesn’t fall (bad). But when I unInput Mouse button(0), and try to drag second time then i can’ to drag him . What do you think is the problem? Is a command like (un)Input.GetMouseButtonDown (0). Maybe if i add code like this to DragRigidbody.js
function OnControllerColliderHit (hit : ControllerColliderHit)
{
if (hit.gameObject.tag == "kyb")
{
(un)Input.GetMouseButtonDown (0);
}
}
Cube will fall?
I think this is a serious bug, since no one knows how to fight it. 
I try this code
var disabler : DragRigidbody;
function Start()
{
disabler = gameObject.GetComponent(DragRigidbody);
}
function OnControllerColliderHit (hit : ControllerColliderHit)
{
if (hit.gameObject.tag == "kyb")
{
Diss();
}
else
{
Dizz();
}
}
function Diss()
{
disabler.enabled = false;
}
function Dizz()
{
disabler.enabled = true;
}
But still working only when we Touch cube we cant drag him. If we drag touch him he’s don’t fall.
Any hints will help. Thank you.
So you have an object on top of something else. You want to be able to drag that object to the side, but when there is nothing underneath to support it, you want the object to fall. Is that basically what your code is doing? If so, you might be better using OnCollisionExit to detect when the object is not touching the platform underneath. When this happens, just stop applying the DragRigidbody effect.
No, game is based on the folding cubes. You have to put the cube on cube, and so on until the summit. The problem is that if you drag the cube, jump at it, you can fly to the hill. It is necessary that in the player collide with cube → cube fell. andeeee thank you for your attention. I really appreciate it.
andeeee Plese see this video! And you will know, what I am talking about. (I cant to atach it because is ~5mb). I upload it here http://slil.ru/28229709 . Hope you can download from Russian servers, if not i reupload it wherever you say. Just wait 10 seconds.
Ah, I see!
What I would recommend you do here is make a modified version of the DragRigidbody script (it’s in Standard Assets/Scripts). Add a boolean variable called “enableDragging” (or whatever) and test for it in the DragObject method - If it is true, allow the drag to take place, but if it is false then don’t.
while (Input.GetMouseButton (0) enableDragging)
You can set this boolean value from the other script with:-
disabler.enableDragging = false; // or true...
OH MY GOD!!! AT LAST!!! andeeee million THANK’s to YOU!!! I racked brain about 2 weeks. And no one can halp me. And you, you, You are the best andeeee on EARTH! OMG i am almost crying from happiness. Thank you very much!