# Walking on walls?

 0 I want a game where buildings and things are climbable like the game [prototype], the way it would work is that if youre pressing the Z key you enter free-run mode. Im fairly new to scripting and only know JavaScript, tutorials would be apreciated so I can get it fixed into my head and maybe prevent me from asking more questions than I need to. `````` -Thanks in advance `````` more ▼ asked Sep 23 '10 at 05:00 PM DILLAghost 47 ● 2 ● 2 ● 6 I want to do that too... you have to write your own character controller. in a simple way I guess you want when you collide to a wall the forward input key to be translated to the upward input key. Mirror's edge had a much more complicated structure where each of the grip points were behaving differently. Great stuff. Sep 23 '10 at 09:13 PM alexnode what's with the free tag? Jun 25 '12 at 01:02 PM Matt Downey add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 I'm always late in answering questions on Unityanswers, but... ``````function Pace (normal : Vector3, vect : Vector3) { //By dot product/negative inverse, this is orthogonal to the normal var right : Vector3 = Vector3(normal.y,-normal.x,0); //in world space var forward : Vector3 = Vector3(0,-normal.z,normal.y); //in world space right.Normalize(); forward.Normalize(); //the direction the player will move (tangential), //which is a combination of any two non-parallel vectors on the correct plane var direction : Vector3; direction = right*vect.x + forward*vect.z; direction.Normalize(); return direction; } function GetMoveDir (horizontal : float, vertical : float) //The basic user-input function, which calls subsequent f(x)'s { moveDir = Vector3(horizontal, 0, vertical); moveDir.Normalize(); //makes sure the player can't travel @ 1.41x diagonally } function FixedUpdate () { GetMoveDir(Input.GetAxis("Horizontal"),Input.GetAxis("Vertical")); } ``````The first function takes in the "vect" from "GetMoveDir," all you have to do is insert the "normal" from a raycast.Should work 100% of the time if I copied the right bit.Also, I always use Translate(vector, Space.World) or more recently Rigidbody.MovePosition, Translating an object with respect to itself gets annoying during jumps, as you have to recalculate every--single--frame.This will work on walls and ceilings. It'll work as you expect on walls and floors, but if I'm not mistaken, ceiling controls will be inverted.I wrote all this myself, so I should know the fine details a little better, but w/e. more ▼ answered Jun 25 '12 at 12:51 PM Matt Downey 287 ● 4 ● 6 ● 7 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 Another "easy" way to do this, using Unity's charactercontroller is by using "Slope Limit". It's a build-in function which allows you to change how high a slope your character can walk, run or climb. - I know this isn't exacly like PoP but it's a start, right? :) Hope this will help :) more ▼ answered May 03 '12 at 07:15 AM Sejersen 18 ● 2 ● 3 ● 5 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 To run up walls isn't bad, but gets trickier depending upon how you implement your running in the first place. The simple solution is to raycast in the direction you are running and align your animations to the surface if it is within a certain distance (the distance you'll be moving in the current frame for example). If you add inertia or anything like that, you'd want to consider that too. I recommend looking at the locomotion system for more on aligning animations to a surface. Raycasting is simple. ``````var hit : RaycastHit; if(Physics.raycast(transform.position, moveDirection, hit, amoutToMoveThisFrame) { //align yourself to hit.normal as up } `````` Also, since you know that the normal you're aligned to is not the world up, you can do smart things like balancing the weight against the surface (wall running la Prince of Persia). You should also take into account collisions and the character's lean if they lean into their running animation. more ▼ answered Sep 23 '10 at 09:08 PM skovacs1 10k ● 11 ● 25 ● 91 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x161
x72
x69
x67
x15

asked: Sep 23 '10 at 05:00 PM

Seen: 2718 times

Last Updated: Jun 25 '12 at 01:02 PM