i don’t know how to write a script for bge. somebody help me
can anyone write a script by which object owns hit position of ray with -1 unit in y axis and -1 unit in z axis and track to hit position???
thanks in advanced
i don’t know how to write a script for bge. somebody help me
can anyone write a script by which object owns hit position of ray with -1 unit in y axis and -1 unit in z axis and track to hit position???
thanks in advanced
No i have no idea. Sorry.!
Maybe I better first ask what you’re trying to do exactly?
you will have constant motion, if the object casting the rays tracks it’s own ray, (flipping over and over?)
So you want your character to climb only with his/her front side?
Or you want your character to rotate to face the wall when climbing?
Maybe a picture of the problem?
I would suggest adding a separate collision box in front (outside) of the character to detect collision with the wall.
Took the liberty to modify your setup.
Solution is quite simple in python.
I just align the character to the normal of the ledge face.
You might want read about them if you don’t exactly understand what is going on.
ledge_climb_vegetabled.blend (858 KB)
Oh I get it know. So your character’s direction is not straight to the wall (he’s turned). To ensure this you should get the orientation of the face in front of the character when climbing. You can get this with casting a ray through Python. Here’s an example of how it can be done. (controls: spacebar and arrow keys).
Note: The player’s front is facing along the X-axis. Normally this would be the Y-axis, but alignAxisToVect doesn’t seem to work properly in that case. So that’s why it is setup this way.
Edit: VegetableJuiceF beat me to it, and probably his solution will be sufficient enough. Also I think what I said about alignAxisToVect not working properly on the Y-axis may be false, because it seems to work fine in his example. I have to look into it.
Edit2: Changed the blend. Thanks, VegetableJuiceF, this solved a problem of my own.
@ KASHI$H: So the difference with the example VegetableJuiceF gave you is that:
Ledge_align_example.blend (86.5 KB)
oh yeah thanks all since i am not a python user i can’t understand whats going on but the thing is solved so thanks
:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D