|
I have a character with two raycasts on it. The movement controls change depending on which raycast is in contact with a collider. This is done with a boolean (in Java Script): (Not actual code!) The problem is, the controls will begin as control-set 1. when the 2nd raycast hits a collider, it will change to control-set 2. When raycast 1 then hits a collider, it won't change the controls. So what i need is: If raycast 1 is touching a collider and then raycast 2 comes into contact with a collider, automatically default to raycast 2 and vice-versa. Hope that's clear enough :)
(comments are locked)
|
|
Code please, im having a hard time understanding what you mean. You could just make an if-sentence stating that if raycast 2 is null, then it should use raycast 1. Edit: this would have worked if you had only had 3 controls, you should be able to adapt it into 4 controls if you play around with it for a bit. playing around with as many bools as you've got is just silly :P
(comments are locked)
|
|
I wanted to keep things simple with the question, there are actually 4 raycasts :p holy batshit, you could also just have edited into your own post, instead of making a new answer :)
Oct 06 '11 at 12:54 PM
Kacer
but yeah, i think i understand what it is you want, basically you want a game where you can walk on walls and cielings, if im not wrong.
Oct 06 '11 at 01:08 PM
Kacer
Check my first answer, i've updated it with some code that might help, its in c# though, you only need to change it into javascript, shouldnt be too hard :)
Oct 06 '11 at 01:24 PM
Kacer
yeah, thats right :) I'll mess about with the code you posted above, thanks for your help :) :) :)
Oct 06 '11 at 01:28 PM
cthugan
oh yeah, also you would want to look at "input.getaxis" http://unity3d.com/support/documentation/ScriptReference/Input.GetAxis.html
Oct 06 '11 at 01:34 PM
Kacer
(comments are locked)
|
