- Home /
Question by
2Pacula · Mar 07, 2014 at 05:43 PM ·
physicsvector3controller
Wall Running using Javascript
Hi Everybody, at the moment I am making a first person parkour game kind of like mirror's edge with the wall running of Titanfall, and at the moment I'm not sure how to make the player wallrun, this is what I have at the moment:
var characterController = gameObject.GetComponent(CharacterController);
var characterRadius : float = characterController.radius;
var rayOrigin : Vector3;
var hit : RaycastHit;
var CharController : CharacterController = GetComponent(CharacterController);
function OnTriggerEnter(other : Collider) {
if (other.gameObject.tag == "Wall" && !grounded) {
rayOrigin = transform.position + transform.right * characterRadius;
if (Physics.Raycast(rayOrigin, transform.right, hit, 1.5)) {
CharController.Move(transform.up + transform.forward);
}
// Left edge forward facing raycast
rayOrigin = transform.position - transform.right * characterRadius;
if (Physics.Raycast(rayOrigin, -transform.right, hit, 1.5)) {
// Executed on left side hit
}
}
}
I've tried to move the player up and forward using transform.position, however it jerks the player up to far for the timing, any answers would be appreciated.
Comment
Your answer
Follow this Question
Related Questions
How to archive anti-gravity controlls for a racer? 0 Answers
Unwanted gameObject movement after jumping. 1 Answer
Unity3D HELP! How can i pickup/hold/throw object when im rolling ball? 4 Answers
Should I be using time.fixedDeltaTime here? 5 Answers
How do I get my solution to go forward or right on the world axis 1 Answer