- Home /
collider then change rotation converse?
hi!I want to let my player move converse after he touch a box colider.
that my scripts:
public float WalkSpeed=5F;
public float RunSpeed=10F;
public float rotationmove=1;
void Update ()
{
AutoWalk();
if(Input.GetKeyDown(KeyCode.P))
{
Run ();
}
if(Input.GetKeyUp(KeyCode.P))
{
Walk();
animation .Play ("walk");
}
void AutoWalk()
{
animation.Play("walk");
controller.SimpleMove(Vector3.right * WalkSpeed);
}
void Walk()
{
animation.Play("walk");
WalkSpeed=5;
RunSpeed=WalkSpeed;
RunSpeed=10;
}
void Run()
{
//controller.SimpleMove(Vector3.right * RunSpeed);
WalkSpeed=RunSpeed;
runtime=Time.time;
animation .Play ("run");
}
void OnControllerColliderHit(ControllerColliderHit hit)
{
if( hit.gameObject.tag =="Door")
{
Destroy(hit.gameObject);
WalkSpeed=WalkSpeed*rotationmove;
RunSpeed=RunSpeed*rotationmove;
}
}
Love the enthusiasm, but could you edit your question (and it's title) so that we get a better understanding of what you want to achieve, what's happening now and what you've tried? Also, when posting code, please make sure you use the Code Sample formatting option (its image is of 1's and 0's - cute, right?). Also, bonus points for correct spelling and grammar.
Looking forward to seeing if I can help at all =)
Hi!!$$anonymous$$ristercollin
Im sorry that use UnityAnswers first time and my poor English!!>.<
I wish you can help me.ThX<3
Your answer
Follow this Question
Related Questions
how can i let my player move converse? 0 Answers
special move with a cube. 1 Answer
Character controller with key click to move forward 0 Answers