- Home /
Upside down wall jumps!
Hey Guys and Gals,
I have been happily using this code to prevent my characters from jumping up walls.
for (var contact : ContactPoint in coll.contacts)
{
if(coll.gameObject.tag == "Floor" && contact.normal.y > 0.6)
grounded = true;
}
This works great, but now in one of my levels, gravity is reversible, I thought it would be as simple as reversing the angle, but apparently not, now my jumping character can wall jumps again when they are walking on the roof and in contact with walls.
Can some suggest why the rules for Y normals change just because I am upside down?
I hope this is clear enough, I'll post more code if it's not.
Many thanks.
The normal is in world coordinates. If you flip the object around, "up" is still "up". It's just your object that flipped around. I may not be understanding your problem correctly but in effect it sounds like you've just turned a table upside down. Regardless if the table is upside down or not, you still jump "up" from it. If you flipped your gravity 180 degrees, I guess you'd check contact.normal.y < -0.6.
Answer by StormSabotage · Dec 10, 2013 at 07:38 PM
Can't be sure without all code, but maybe you should change
contact.normal.y > 0.6
to
contact.normal.y < -0.6
also i think that your roof should be tagged as "Floor" too
Dammit!! right first time < -0.6 I have been scratching my head for hours. Thank you very much!
Your answer
Follow this Question
Related Questions
Normal Walker: Player Y Rotation Snapping back to 0? 0 Answers
Move along surface normal of hollowed pipe with cube 0 Answers
Custom Gravity 1 Answer
Mouse Look from any Orientation 0 Answers
Snapping normals 0 Answers