So I want to create a plane or object that is icy and causes the player character to slide around. I’ve tried to put the ice physic material on a plane with and without a rigid body attached to it, and I’ve changed the ice physic material settings to attempt to get it to change the friction on the player character. It didn’t work.
How do I get the player character to be affected by the plane with the ice physic material (or any physic material)?
- Add the player rigid body and add script the player’s code
- Add tab “ice” on the plane
I wrote JS code below.
function OnTriggerStay (other : Collider) {
if (other.tab == "ice") {
rigidbody.AddForce (Vector3.up * 10);
}
}
you should also add limitation speed code in Update function.
I tried adding it in what you suggested, but I don’t know if I put it in right or understood how to implement it. Either way, I couldn’t get it to work for me, and I don’t really know what I’m doing wrong.
I put the code you wrote on the player script, and added a tag (I’m not sure what a tab is) to the plane, and I couldn’t get it to work.
Oh, I’m sorry.
I mistook ta"b" and ta"g"
please fix b to g
-N/A :<
if (other.tab == "ice") {
-OK :>
if (other.tag == "ice") {
And also set Plane’s Tag (not Tab)
- In the Hierarchy, you click Plane object
- In the Inspector, you click the right-side of “Tag” menu and select “Add Tag…”
- fill “ice” on the right-side blank-box of “Element num” *num is not used number
- Return to the Inspector of Plane object, you click the right-side of “Tag” menu and select “ice” (I always forget the procedure ;<)
FINISH!