[HELP..] Character jump RayCast

Hello :stuck_out_tongue:

I’m creating a game and I need help for the jump…

I need to detect if there is a property ground below the character… So I used an empty (parented to the character) and a ray sensor, but unfortunately didn’t work…

I read that RayCast was the solution, but I don’t know what is that…

Could anyone please tell me what “RayCast” is and how it can help…??
:eek::eek::eek::spin::spin::spin::eek::eek::eek:

I guess you want that your character is jumping only when it touches the property ground
there is an easy way to do this by using the touch sensor

Thank you for the reply… But this is not the solution… If I do that, then I will have to separate the walls from the ground, which is very hard in a big scene and also increases the faces of the scene…

yes you’re right. and using a near sensor is the same problem?! Am i right? maybe you could add a child plane under the character that has a touch sensor, so it won’t jump when its just near a wall

When asking for help, post a blend too, as there could be many things wrong.

To give you an idea, this is a logic block demo: The ray logic block is facing downwards (-Z) to a distance of 5 units. When this detects a property ‘ground’ (the plane) plus the player presses the space key the ‘and’ block will fire and the motion actuator pushes you up.

You can also set this logic block to detect materials too.

Hope this helps

Paul

Attachments

RayJump.blend (454 KB)

Yes my friend, I tried ALL these solutions but unfortunately not one of them worked properly…

If I try to jump against a wall, the character sticks on it…

I agree with rubbernuke when you have tried this all out the only way is to upload the .blend so that others can fix it :wink:

The Ray sensor can do what you need - you would just fire in the -Z direction with a range of, say, 1.0 Blender Units. If there’s a collision and you press Space, the character would jump. Where are you having problems?

Dear SolarLune, this work pretty well… The only problem is when you jump on a wall, then the character sticks on it…

Here is a blend file : test.blend (424 KB)

Right and Left arrows to move and spacebar to jump…
Note : Try to jump on the wall while pressing the right arrow and the player will stick on it…

So please anyone HELP ME with another solution, or find something to make the character not to stick on the wall…

Please ANYONE… I stacked on that problem and I can’t continue my game… I need HELP!!

Hi trallalla,
testFix.blend (423 KB)
here is what i’ve changed

  • servo control to simple motion (using force-movement)
  • changed the range of the ray
    I hope this will help you :wink:

Thank you nickdiesel !! :cool: The force instead of serco control works pretty well, but after you jump, you can’t move while the player is on air… Can you tell me a way to solve this problem please??
:eek::eek:

Behold…

All you have to do is disconnect the Ray sensor from the AND controllers that involve the keyboard movement.

They way is was set-up, is that the ground sensor has to be active in order for the box to move

Logic says: Left key + Ray sensor detecting ground = movement.
You just want: Left key = movement (meaning that it doesn’t matter if on ground or in air, it will still move)

Enjoy

Attachments

testFix 2.blend (359 KB)

:spin: Oh, yeah my friend but now we got the first problem again : THE CHARACTER STICKS TO THE WALL…!! If you try to jump against the wall while pressing right arrow key, you will see that…

With the solution of nickdiesel, the character didn’t sticked on the wall…

Is there a way to combine that two ways?? (the character not to stick on the wall and ability to move while jumping)… :eek::eek:
Thanx anyway for any help you give…

the character sticks to the wall because 50 force is the perfect number to nullify gravity.

Try using 40 or 30

I tried 30 and the character still semi-sticks on the wall. It moves quite slow too… So I can’t (obviously) decrease it furthermore…
Any better solution please?

A fixed version. The problem was low mass and high friction.

Increased mass to 10, and forces to.

Decreased friction in material to 0.1

testFix 3.blend (460 KB)

I can’t look at the file right now, so I don’t know if this will work, but try using linear velocity instead of force.

:cool::cool::cool:Thank you LaH for your reply!!! You have done AWESOME WORK !!! You finally found a solution that works properly…!:cool::cool::cool:

By the way, what do you mean mcguinnessdr by saying “linear velocity” ?? Do you mean servo control??

No, in the simple motion it should say LinV, that’s what I meant.