- Home /
2.5D ledge hang with javascript
Hi there people.
I am trying to construct a script which will allow my character to jump up to a cube, cling to the edge and then allowed to jump up.
I am unsure how I would go about this for 2.5.d
how would I raycast from the top of the cube and the player detect it ?
heres what ive got so far - which is not working for me
var ledge : Vector3;
var Edge = transform.TransformDirection(Vector3(1,0,0));
var hit : RaycastHit;
function Update(){
Debug.DrawRay(transform.position, -Edge*1, Color.blue);
if(Physics.Raycast(transform.position, -Edge, hit,2)){
hit.gameObject.SendMessage(transform.position.x, ledge);
}
}
I would appreciate some advice on this as everything Ive found so far is all about 3d platformers which I cannot make sense of.(fairly new to unity coding still)
Cheers
What does 2.5D mean in your case? Sidescroller-like, isometric, ...?
Yeah, is it really 3D but viewed from a fixed camera? Or isometric 2D graphics illustrated in a way that is 3D-like? They can make a lot of difference regarding your Collider which the Raycast should hit. Does the Raycast hit?
yeah its a fixed camera platformer sidescroller - really just a 2d view but using 3d objects - and the raycast doesnt hit. Id appreciate your help ppl cheers
forgot to mention the raycast doesnt even appear in scene view when i run the game
Just a note. There is no need to multiply a variable by one, it changes nothing. x*1 = x.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Cube terrain with perlin noise 1 Answer
I need help with my Door Switch Configuration. 1 Answer
attract particles 3 Answers
Every 0.5 sec there is a 10% chance of a target spawning. 2 Answers